PYTHON+DJANGO+UWSGI Building Environment

Source: Internet
Author: User
Tags install django pip install django

Step one: Build a python environment

It is best to use pyenv to manage the Python environment in multiple versions very well.

Step two: Build a Django environment

Install by using PIP install django==1.12.1

When installed, you can use the Create a lab project to make Django successful.

django.admin.py Startproject Demo

Then CD demo inside

Use Python manag.py Runserver to experiment with whether Django can start

Step Three: Build UWGSI environment

Install using the PIP install Uwsgi

Edit a Uwsgi.ini file

Content according to their own needs to set

[Uwsgi]
Socket = 0.0.0.0:9000
Master = True
Pidfile =/usr/local/nginx/uwsgi.pid
processes = 8
Workers = 2
ChDir =/data/www/demo
Pythonpath =/data/www
Profiler=true
Memory-report=true
Enable-threads = True
Logdate=true
limit-as=6048
Daemonize=/data/logs/django.log

Fourth step: Build Nginx Environment

server {
Listen 81;
server_name demo.domain.com;

Location/{
Uwsgi_pass 127.0.0.1:9001;
Include Uwsgi_params;
Uwsgi_param Uwsgi_chdir/data/www/omserverweb/demo;
Uwsgi_param Uwsgi_script Wsgi;
Access_log/var/log/nginx/testaccess.log main;
}

}

Where problems can be seen in Nginx and Uwsgi logs to resolve the step-by-step exclusion

First troubleshoot Django in troubleshooting Uwsgi

PYTHON+DJANGO+UWSGI Building Environment

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.