Installation
These distributions will be installed automatically when installing Flask.
Werkzeug implements WSGI, the standard Python interface betweenapplications and servers.
comes with Jinja. It escapes untrusted input when renderingtemplates to avoid injection attacks.
ItsDangerous securely signs data to ensure its integrity. This is usedto protect Flask’s session cookie.
is a framework for writing command line applications. It providesthe command and allows adding custom management commands.
These distributions will not be installed automatically. Flask will detect anduse them if you install them.
Blinker provides support for .
SimpleJSON is a fast JSON implementation that is compatible withPython’s module. It is preferred for JSON operations if it isinstalled.
provides a faster, more efficient reloader for the developmentserver.
Use a virtual environment to manage the dependencies for your project, both indevelopment and in production.
What problem does a virtual environment solve? The more Python projects youhave, the more likely it is that you need to work with different versions ofPython libraries, or even Python itself. Newer versions of libraries for oneproject can break compatibility in another project.
Virtual environments are independent groups of Python libraries, one for eachproject. Packages installed for one project will not affect other projects orthe operating system’s packages.
Python 3 comes bundled with the module to create virtualenvironments. If you’re using a modern version of Python, you can continue onto the next section.
If you’re using Python 2, see first.
Create a project folder and a folder within:
On Windows:
- $ py -3 -m venv venv
If you needed to install virtualenv because you are using Python 2, usethe following command instead:
- $ python2 -m virtualenv venv
Before you work on your project, activate the corresponding environment:
- $ . venv/bin/activate
On Windows:
Your shell prompt will change to show the name of the activated environment.
Within the activated environment, use the following command to install Flask:
Flask is now installed. Check out the Quickstart or go to the.
If you want to work with the latest Flask code before it’s released, install orupdate the code from the master branch:
- $ pip install -U https://github.com/pallets/flask/archive/master.tar.gz
If you are using Python 2, the venv module is not available. Instead,install virtualenv.
On Linux, virtualenv is provided by your package manager:
- # Debian, Ubuntu
- $ sudo apt-get install python-virtualenv
- # CentOS, Fedora
- $ sudo yum install python-virtualenv
- # Arch
- $ sudo pacman -S python-virtualenv
If you are on Mac OS X or Windows, download , then:
- > \Python27\python.exe Downloads\get-pip.py
Now you can return above and Create an environment.