Setup a Flask environment
by Anthony
How to setup a proper Flask environment
Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. And before you ask: It’s BSD licensed!
A proper Flask environment need Virtualenv and Virtualenvwrapper. Virtualenv is a tool to create isolated Python environments. You can install it directly from your CLI with PIP. PIP is a Python packages manager.
Installation
To install pip and upgrade it to the last version, run the following:
# Intall
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py
# Upgrade
pip install -U pipAfter that, you can simple install virtualenv and virtualenvwrapper with the following:
# Install virtualenv
$ pip install virtualenv
# Installation and configuration
$ pip install virtualenvwrapper
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.shFlask Environment
Now you have to create a new virtual environment for your project
$ mkvirtualenv flask_projectIn order to use your new virtual environment type:
$ workon flask_projectYou can now install Flask and play with Python with the following:
$ pip install Flask Flask-SQLAlchemyTo return to your main environement, just run:
$ deactivateSubscribe via RSS