Tutorial by Examples

Use pip to install Flask in a virtualenv. pip install flask Step by step instructions for creating a virtualenv for your project: mkdir project && cd project python3 -m venv env # or `virtualenv env` for Python 2 source env/bin/activate pip install flask Never use sudo pip in...
Create hello.py: from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'Hello, World!' Then run it with: export FLASK_APP=hello.py flask run * Running on http://localhost:5000/ Adding the code below will allow running it directly with python hello...
If you want to use the latest code, you can install it from the repository. While you potentially get new features and fixes, only numbered releases are officially supported. pip install https://github.com/pallets/flask/tarball/master
If you want to develop and contribute to the Flask project, clone the repository and install the code in development mode. git clone ssh://github.com/pallets/flask cd flask python3 -m venv env source env/bin/activate pip install -e . There are some extra dependencies and tools to be aware ...

Page 1 of 1