Flask Environment Construction

Source: Internet
Author: User
Tags virtual environment virtualenv

Overview:

Flask is a lightweight WEB application framework written using Python. The WSGI Toolkit uses WERKZEUG, and the template engine uses JINJA2 (similar to the Smarty in PHP, designed to allow the program to separate the interface from the data). Flask uses BSD licensing.

WSGI (Python Web server Gateway Interface) is an interface between a Python application or a framework and a WEB server that has been widely accepted. Similar to the Servelet API in Java.

Installation steps:

1. Install Pip

Execute distribute_setup.py, there will be easy_install under Python scripts, use this script to install PIP

Easy_install pip

2. Installing virtualenv

Virtualenv can create a Python virtual environment, and the environment between the different projects can not conflict. Specific Introduction View: http://www.cnblogs.com/harrychinese/archive/2012/01/09/use_virtualenv_on_windows.html

Pip Install "Virtualenv < 1.11"
Install the version prior to 1.11, or there will be a bug.

3. Create a virtual environment

Create a new project directory and execute it under the new directory:

Virtualenv my_project or python-m virtualenv my_project
When the above command is complete, a new directory My_project is created, as well as a new Python development environment. Then install flask under My_project:

Pip Install Flask

Several problems encountered in the construction process:
Http://askubuntu.com/questions/400343/trying-to-create-a-python-virtual-environment-but-getting-oserror
Http://stackoverflow.com/questions/23523812/fatal-error-when-using-scripts-through-virtualenv-extra-quotes-around-python-e
Http://stackoverflow.com/questions/20925329/trouble-with-creating-a-virtual-environment-in-windows-8-python-3-3

4. Switching the environment

After you create a virtual environment for a project by using virtualenv, you need to activate the environment before you can run this project

Venv\scripts\activate
Venv is the project name




Flask Environment Construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.