django开发环境配置

1、开发环境配置:http://www.runoob.com/django/django-nginx-uwsgi.html

https://www.cnblogs.com/zhming26/p/6158660.html

nginx 配置 http://developer.51cto.com/art/201004/194472.htm

2、项目建设:https://www.cnblogs.com/Python666/p/7071284.html

cd /web/

django-admin.py startproject devops

cd /web/devops

vi uwsgi.ini

[uwsgi]

socket = 192.168.118.3:8080

# Django-related settings

# the django project directory (full path)

chdir =/web/devops

# Django's wsgi file

module=devops.wsgi

#process-related settings

# master

master=true

# maximum number of worker processes

processes =2

threads =2

max-requests=6000

# ... with appropriate permissions - may be needed

chmod-socket = 664

# clear environment on exit

vacuum=true

vi nginx.conf

server {

        listen      80;

        server_name  localhost;

        location / {

            include  uwsgi_params;

            uwsgi_pass  192.168.118.3:8080;              #必须和uwsgi中的设置一致

            uwsgi_param UWSGI_SCRIPT web.devops.wsgi;  #入口文件,即wsgi.py相对于项目根目录的位置,“.”相当于一层目录

            uwsgi_param UWSGI_CHDIR /web/devops;      #项目根目录

            index  index.html index.htm;

            client_max_body_size 35m;

        }

    }

cd /web/devops

uwsgi --ini uwsgi.ini &

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

http://192.168.118.3/

FAQ:

Django:Exception Value: Invalid HTTP_HOST header 解决方法:https://blog.csdn.net/omg2hei/article/details/68950206

你可能感兴趣的:(django开发环境配置)