Preloaded :nginx,  django

Django Site tree

|Site

|-----Blog( Self built projects )

|-----Manage.py

|-----Site(setting url wsgi….)

|       |-----wsgi.py

|-----static

|       |-----js

|  |-----css

|-----uwsgi.log

|-----uwsgi-socket.xml

1.      libxml2、libxml2-devel、uwsgi

1.1  install

notes : Must be installed first libxml2、libxml2-devel, Install again uwsgi

rpm –ivh Libxml2*****

pip:   pip install uwsgi

tar:   python setup.pu install

1.2 test uwsgi

vim testuwsgi.py

def application(env, start_response):

start_response('200 OK',[('Content-Type','text/html')])

return "uwsgi ok!"

Command line execution :

uwsgi --http :8001 --wsgi-file testuwsgi.py

Browser Test :127.0.0.1:8001

2.  To configure Site/wsgi.py

import sys

import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE","logSite.settings")

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()

sys.path.append('/Site')

sys.path.append('/Site/Site')

3. test  uwsgi +django

Carry out orders :

uwsgi --http :8001 --chdir /Site/Site --module wsgi

/Site/Site yes wsgi.py The catalog of

wsgi As module

Browser Test :127.0.0.1:8001

4. nginx + uwsgi + django

4.1  establish nginx + uwsgi  Conduct socket Connect xml file

vim/Site/uwsgi-socket.xml

<uwsgi>

<socket>:8001</socket> <!--  Don't use it. 8000 port , reserve 8000 Easy interpreter testing  -->

<chdir>/Site/Site</chdir>

<module>wsgi</module>

<processes>4</processes><!--  Number of processes  -->

<daemonize>uwsgi.log</daemonize><!--  Create a log file  -->

</uwsgi>

4.2  modify nginx.conf  The configuration file

server {

listen            8080;

server_name www.site.com;

access_log/logs/access.log;

error_log/logs/error.log;

location / {

include        uwsgi_params;

uwsgi_pass     127.0.0.1:8001;

uwsgi_paramUWSGI_CHDIR  /Site/Site;

uwsgi_paramUWSGI_SCRIPT wsgi;

}

# Static file path

location /static {

alias/Site/static;

}

}

4.3  restart nginx  service

cd /usr/local/nginx/sbin

./nginx -s reload

4.4  start-up uwsgi  The server

uwsgi -x django-socket.xml

4.5  Access the service

ip:8080

www.site.com

nginx+uwsgi Deploy django More articles about

  1. Filling pit !!!virtualenv in nginx + uwsgi Deploy django

    One . Why is there this article First contact uwsgi and nginx , This environment builds , Step in too many pits , Now write it down , Let the latecomers avoid detours . Originally Ubuntu14.04 On Set up the environment , And then to centos7. ...

  2. nginx + uwsgi Deploy Django+Vue project

    nginx + uwsgi Deploy Django+Vue project windows Local DNS analysis File path C:\Windows\System32\drivers\etc Single machine local test running mode , call dj ...

  3. Python3.6+nginx+uwsgi Deploy Django Application to alicloud Ubuntu16.04 System

    Python3.6+nginx+uwsgi Deploy Django Application to alicloud Ubuntu16.04 System This is written Django When the program is running on the local machine , A query interface . preparation 1. First, buy an alicloud EC ...

  4. nginx + uwsgi Deploy django project

    Due to project requirements , Need to deploy django project , Here's the basic nginx coordination uwsgi Deploy django, Later, we will adopt docker How to deploy Environmental Science : centos7 python3.5.4 django2.1.4 u ...

  5. Production environment use Nginx+uwsgi Deploy Django

    Run locally django The application is relatively convenient , Use native runserver Start it up . If you deploy in a production environment django, It's time to think more about . For example, static file processing , Security , Efficiency and so on Found a good deployment of teaching on the Internet ...

  6. Nginx + uWSGI Deploy Django project , And load balancing

    One .uWSGI The server uWSGI It's a Web The server , It has achieved WSGI agreement .uwsgi.http Such agreement .Nginx in HttpUwsgiModule Its function is to communicate with uWSGI The server exchanges . it is to be noted that WSGI ...

  7. solve nginx+uWSGI Deploy Django When I met static file 404 The problem of

    Yesterday was the use of Django Self contained runserver Deployed servers , But because of runserver It's not stable , So it was decided to adopt uWSGI+nginx Deployment . It was installed yesterday uwsgi and nginx, Use this command to open 8 ...

  8. CENTOS7 Use Nginx + Uwsgi Deploy Django project

    Let me write it out front Recently, I always see new students Django My friends are deploying their own projects to Linux It doesn't work up there , So I started writing this blog . For those who can't build Python 3 Friends of the environment can refer to the previous blog [CE ...

  9. Use Nginx+uWSGI Deploy Django project

    1.linux install python3 Environmental Science Reference link :https://www.cnblogs.com/zzqit/p/10087680.html 2. install uwsgi pip3 install uwsgi l ...

  10. ubuntu+nginx+uwsgi Deploy django web project

    Preface Will be developed locally django The project is deployed to linux Upper uwsgi The server , And configuration nginx, Completion is based on ubuntu+nginx+uwsgi It's running online . Here are the steps . Server configuration virtualenv Such as ...

Random recommendation

  1. problem (bug) It's not really in the logic of the code , It's often configuration 、 Outside of authority or business logic ( turn )

    Not all of them bug It's all paper tigers , But it's often the kind that seems very wonderful bug, The reason is really simple , I've been bothering you for a while , Finding the truth makes you laugh . What is wonderful bug Well . My definition is : The code logic is the same , But in A It's good , here we are B Chujiu ...

  2. stay HTML5 Capture audio and video in

    brief introduction For a long time , Audio / Video capture is all part of network development " grail ". these years , We always rely on browser plug-ins (Flash  or  Silverlight) To achieve this . Come and see ! Now it's... Turn HTML5 Big ...

  3. sqlserver Table operations SQL piece

    Database knowledge points 1. Database operation : increase :insert into Table name values( value 1, value 2, value 3) Delete :delete Name from Table name where Conditions Change :update Table name set = value wh ...

  4. Use WPF Making video surveillance multi screen switching

    Preface There was a product , One function is the video monitoring module , The first thought of video surveillance is video multi screen switching function , Because the front end is used WPF Developed , So we made a multi screen switching component at that time , The effect is as follows : Function design premise : Due to the use of Haikang Dahua world ...

  5. LeetCode(17): Letter combination of telephone number

    Medium! Title Description : Given a number only  2-9  String , Returns all the letter combinations it can represent . The mapping of numbers to letters is given as follows ( Same as phone key ). Be careful 1 Does not correspond to any letter . Example : Input :"23& ...

  6. jenkins start-up appium service

    Want to be in jenkins in , Automatic timing start appium service ,shell The order has been prepared as follows : BUILD_ID=dontKillMe echo "" > appium.log nohup ...

  7. python Delete dictionary elements from the list

    data={"} ,{"}]} print("before:\n\n",data,"\n\n") temp=- k= for i in da ...

  8. QT Login dialog

    This article was originally written by Qter The open source community (www.qter.org), author yafeilinux, Reprint please indicate the source ! Text One . Create project 1. newly build Qt Gui application , Project name: “login”, Class names and base classes keep MainWi ...

  9. idea Configure multiple jdk

      1.File -->Project Structure 2.SDKs--> Click on + Number -->JDK--> Directory selection to jdk Folder location 3. choice jdk Location path 4. You can configure more ...

  10. hdu1003 The largest substring and

    Max Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Sub ...