您的位置:首页 > 运维架构 > Nginx

python django uwsgi nginx   实例

2016-12-18 19:18 363 查看
实例:192.168.200.1331.安装djangowget https://www.djangoproject.com/download/1.7.11/tarball/1.3.安装
cd Django-1.x.y
sudo python setup.py install
1.4.创建
django-admin.py startproject testdj
1.5.启动测试
cd testdj # 切换到我们创建的项目
python manage.py runserver
2.安装 uwsgiwget https://projects.unbit.it/downloads/uwsgi-2.0.14.tar.gztar xvf  uwsgi-2.0.14.tar.gzcd  uwsgimake报错: plugins/python/uwsgi_python.h:2:20: error: Python.h: No such file or directoryyum install python-devel  ###再make 编译通过3.配置nginxserver{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/lsdjango-admin.py startproject OMserverweb4配置nginx uwsgi.inicat /usr/local/nginx/conf/uwsgi.ini[uwsgi]socket = 0.0.0.0:9090master = truepidfile = /var/run/uwsgi.pidprocesses = 8chdir = /data/www/OMserverwebpythonpath = /data/www/profiler = truememory-report=trueenable-threads=truelogdate=truelimit-as=6048daemonize=/data/nginx/logs/django.log5.启动
# uwsgi --ini /usr/local/nginx/conf/uwsgi.ini# /usr/local/nginx/sbin/nginx -t/usr/local/nginx/sbin/nginx至此,配置结束,测试成功;谢谢;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python django uwsgi