Deploying Flask (IIS+WFASTCGI) under Windows servier2008+virtualenv

Source: Internet
Author: User
Tags virtual environment virtualenv

Because the business has only one Windows Server2008 Server, the general Nginx+uwsgi deployment method does not work, the following records the deployment process, this article references from: https://www.cnblogs.com/xiaolecn/p/5111076.html

I. Deployment of the project

1, Server Installation python3.6: According to the number of users to download the installation: https://www.python.org/downloads/windows/

Since python3.6 has already installed Pip, the rest of the work is simple.

  

2, install VIRTUALENV virtual environment:

Install virtualenv

3. Create a virtual environment:

Virtualenv env_36

4. Configure the Virtual Environment module: Activate the virtual environment first, then install the modules required by the project.

Install -R requirements.txt

5, code migration, omitted here, and then check whether the virtual environment is normal:

0.0. 0.0 8000

Note: If you check the normal description of the project these are OK, below you can make IIS-related configuration.

II. IIS and WGASTCGI configuration

1, installation wfastcgi:

Install wfastcgi

Note: This is a global installation and is not installed in a virtual environment.

2, in the python3.6 installation directory: Lib/site-packages folder, find: wfastcgi.py this file.

Copy this file to your project root directory:

3. Add an app to IIS:

3. Under your website, locate the "handler mapping" double-click to open:

4, add the module mapping: attention to the picture of the 2nd mark. (d:\python\env\dev_36\scripts\python.exe| D:\Python\PRO\cms\wfastcgi.py) The front part is the virtual environment path, | The wfastcig.py path in the project is followed by the number.

5, the request limit in the (map below √ remove)

6. Confirm Add Module

7, this time you should be able to see your flaskfastcgi program

8. Go back to the IIS console and go to "fastcgi settings"

9, double hit Open you should be able to see the fastcgi you just added:

10, double-click, edit-"Environment variable"

Add 2 variables here:

PYTHONPATH Value: Project path: (for example: D:\PYTHON\PRO\CMS)

The Wsgi_handler value is: The project launches the app in the file, because I am booting through manage.

11. Recycle the application pool and restart IIS.

12, enter the address test, no problem should be able to access the normal.

Deploying Flask (IIS+WFASTCGI) under Windows servier2008+virtualenv

Related Article

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.