Configure nginx proxy Django in Windows

Source: Internet
Author: User
1. Install djanjo

1. Download source code

Https://www.djangoproject.com/download/

The djanjo version downloaded in this article is 1.5.1. The download link is as follows:

Https://www.djangoproject.com/m/releases/1.5/Django-1.5.1.tar.gz

2. Installation

Go to the source code directory and execute the following command:

Python setup. py install

3. Verify djanjo

 
>>>Import Django>>>Print (Django. _ path __)['C: \ python27 \ Lib \ Site-packages \ Django']>>>Print (Django. get_version ())1.5.1
Ii. Use djanjo to generate a simple web page

1. Add Environment Variables

Add the PATH variable to the directory c: \ python27 \ scripts where the file django-admin.py is located.

2. Create a djanjo Project

 
Django-Admin. py startproject testsite1 # create the diango project testsite1cd testsite1manage. py runserver8090# Provide services on port 8090

3. Running Effect

Access can be made through 127.0.0.1, but not through the local lan ip address.

3. Use nginx for proxy

1. Download nginx

Web: http://nginx.org/en/download.html

The nginx version used in this article link: http://nginx.org/download/nginx-1.4.1.zip

2. Configure nginx

Enter the conf folder, open the nginx. conf file, and add (or modify to) the following content:

Server {Listen80;#Pay attention to port occupation issuesLocation/{Proxy_pass HTTP://127.0.0.1:8090;}}

3. Running Effect

You can see that the virtual machine can access the website through the IP address.

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.