python django uwsgi nginx 執行個體

來源:互聯網
上載者:User

標籤:python django uwsgi nginx   執行個體

執行個體:192.168.200.133


1.安裝django 

wget  https://www.djangoproject.com/download/1.7.11/tarball/ 



1.3.安裝


cd Django-1.x.ysudo python setup.py install

1.4.建立

 django-admin.py startproject testdj

1.5.啟動測試

cd testdj # 切換到我們建立的項目

python manage.py runserver


2.安裝 uwsgi


wget https://projects.unbit.it/downloads/uwsgi-2.0.14.tar.gz 



tar xvf  uwsgi-2.0.14.tar.gz 


cd  uwsgi


make 


報錯: plugins/python/uwsgi_python.h:2:20: error: Python.h: No such file or directory 

 


yum install python-devel  ###再make 編譯通過

650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" border="0" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s5.51cto.com/wyfs02/M02/8B/B3/wKioL1hWcEqTlHtOAAIedsV6Pn0432.jpg" title="1.jpg" alt="wKioL1hWcEqTlHtOAAIedsV6Pn0432.jpg" />



3.配置nginx 


server{
    listen 80;
    server_name localhost;
 
    location / {
        uwsgi_pass 127.0.0.1:9090;
        include uwsgi_params;
        uwsgi_param UWSGI_CHDIR  /data/www/OMserverweb;
        uwsgi_param UWSGI_SCRIPT django_wsgi;
        access_log off;
    }
    location ^~ /static{
        root /data/www/OMserverweb/OMserverweb;
    }
 
    location ~* ^.+.(mpg|avi|mp3|swf|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|txt|tar|mid|midi|wav|rtf|mpeg)$ {
        root /data/www/OMserverweb/OMserverweb/static;
        access_log off;
    }
}



   cd /data/www/
   ls
   django-admin.py startproject OMserverweb



4配置nginx uwsgi.ini


cat /usr/local/nginx/conf/uwsgi.ini 
[uwsgi]
socket = 0.0.0.0:9090
master = true
pidfile = /var/run/uwsgi.pid
processes = 8
chdir = /data/www/OMserverweb
pythonpath = /data/www/
profiler = true
memory-report=true
enable-threads=true
logdate=true
limit-as=6048
daemonize=/data/nginx/logs/django.log


5.啟動





# uwsgi --ini /usr/local/nginx/conf/uwsgi.ini

#  /usr/local/nginx/sbin/nginx  -t 

 /usr/local/nginx/sbin/nginx  

650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" border="0" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" border="0" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />


650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/8B/B7/wKiom1hWcGrQSPPDAASzqIX-Elo257.jpg" style="float:none;" title="22.jpg" alt="wKiom1hWcGrQSPPDAASzqIX-Elo257.jpg" />






650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/8B/B3/wKioL1hWcGuBUMDYAAE7C9OLiX8435.jpg" style="float:none;" title="333.jpg" alt="wKioL1hWcGuBUMDYAAE7C9OLiX8435.jpg" />

至此,配置結束,測試成功;謝謝;








本文出自 “好先生2020” 部落格,請務必保留此出處http://fuyuan2016.blog.51cto.com/8678344/1883785

python django uwsgi nginx   執行個體

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.