http://flask.pocoo.org/docs/0.10/quickstart/
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-14-04
http://stackoverflow.com/questions/16344756/auto-reloading-python-flask-app-upon-code-changes
http://www.tutorialspoint.com/flask/flask_file_uploading.htm
Note:
-for a route, always the first function after the route declaration is called, no matter how many router and how many functions are together.
Minimum app is: (6-lines of code)
- Create file: any_file.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def any_function():
return 'Hello World!'
app.run() # put debug = True : for auto reload of updated script as: app.run(debug = True)
# Run Flask server: python any_file.py # Runs the server on localhost at default port 5000
# Program flow:
- when app.run is called, a running web server is setup
-When the local host is contacted by any browser on the above port, data stream is directed to the Flask framework that in turn directs to the flask calling file; any_file.py (in this case)
-The function just next to the called route is called.
No comments:
Post a Comment