Python Flask Get Started
Flask is simple WebFramework for Python.
Different from Django, the feature is simple. But it becomes more and more popular.
If you have pip, just simple
pip3 install Flask
First Simple Application
To create project, Flask doesn’t have any command.
Create project folder by myself and make python file
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__== '__main__': app.run()
Create simple routing and application run code.
To start this web application run python
This application runs with http://localhost:5000
Debug mode is helper for debug application.
To add one line, we can test without stop and run.
This plays auto reload
app = Flask(__name__) app.debug = True # Debug mode on