Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm using EVE for couple of days to create my own REST API but I want to have custom Flask Controller integrated with EVE is there any possibility to do this? Thanks.
Ok I will answer my own question. After reading more about Eve, you can use any of Flask's methods because Eve is simply inheriting from the Flask class. For example, you can do this:
from eve import Eve
app = Eve()
#app.route("/x")
def hello():
return "Hello World!"
if __name__ == '__main__':
app.run(debug=True)
There's more info at the Flask documentation site here: Flask
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
After building a flutter web app with
flutter build web
I want to deploy this with dango server, what should i do?
I'm assuming that your backend is an API Rest and does not render the HTML.
The "right" way will be to have a service for the SPA, and another for the API. For example, with docker, droplets, kubernetes, DO and Heroku.
Another way that I'm thinking is... you specified a route (like example.com/) to serve the flutter web project (I mean the HTML), and the other routes can be the endpoints.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm new to Flask but have experience with PHP. I know there are session variables and global variables just as in PHP, but what do the contexts actually mean? I read the documentation but could not understand whet it was saying.
What are the application and request contexts, and what the is app.app_context()?
app.app_context loads the application and any extentions you have loaded.
A request context is loaded when you are dealing with a request.
A good example.
If you have a background cron that does some database work, you'll need to make use of app_context to get access to the models.
You'll be a in request context pretty much whenever you're handling a view.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to write a custom error log class, which would show me the errors returned by the code. I don't use google app engine, I use python tornado framework.
So can anyone guide me with steps to follow.
I have actually got the steps to follow to create the custom logger from the below link:
Python: custom logging across all modules
But how do i actually store the logs in db and pull it and post it on my front end.
import logging
logging.basicConfig(...)
try:
do.something()
except Exception:
logging.exception("aiii!")
Eventually you'll want to move off basicConfig.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am learning Flask and I want to practice by making simple web app.
I want to make a chat web app that allows sending messages between two or more web browsers in Flask but I am not sure where to start or go about building this application. This question is pretty broad but what I want to know is how to structure this application. What are the pieces I need to build this application.
very broad question, but I'd recommend starting here with web sockets http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent . Then you can have two member subscribe to a channel and make messages to each other.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need to design a API where a request is made to the URL and in turn return a response.
Now i do not want to use any framework as such.
So my question is how can i make this happen.I want to send a request from the web browser and get the response.I have the apache server setup.So where should my python code leave to receive the request and how to respond back
EDIT
import urllib2
request = urllib2.Request('http://localhost/')
request.get_method = lambda : 'HEAD'
response = urllib2.urlopen(request)
response.info().gettype()
Try Flask, it's a microframework and setting it up should be a one-liner.
http://flask.pocoo.org/
Here're the docs for configuring Apache to run it:
http://flask.pocoo.org/docs/deploying/mod_wsgi/
I know you said no frameworks, but this is a lot more simple than doing it yourself.