醉梦半醒的博客

centos7 django+uwsgi+nginx配置

字数统计: 151阅读时长: 1 min
2018/09/16 Share

 

安装epel扩展源:


sudo yum -y install epel-release

 


建立仓库:vi /etc/repos.d/nginx.repo

 


写入源:


[nginx]


name=nginx repo


baseurl=http://nginx.org/packages/centos/$releasever/$basearch/


gpgcheck=0


enabled=1


重启:systemctl restart nginx

 


yum install python-devel


Pip install uwsgi


Pip intsall django


djangoadmin.py startproject HelloWord


在我们创建的项目里修改setting.py文件


ALLOWED_HOSTS = [‘’] #在这里请求的host添加了


后台运行:nohup python manage.py runserver 0.0.0.0:8000& 默认8000端口

 

参考:http://www.runoob.com/django/django-nginx-uwsgi.html

https://stackoverflow.com/questions/48822571/syntaxerror-generator-expression-must-be-parenthezised-python-manage-py-migra

 

nginx默认目录/usr/share/nginx/html

CATALOG