关于django项目部署在服务器上的二三事
django项目中的setting设置
DEBUG = FALSE
ALLOWED_HOSTS = [
'.example.com',
]
ALLOWED_HOSTS = ['*']
安装nginx+uWSGI(环境Centos)
>>>yum install nginx
>>>pip -V
>>>yum install python-pip
>>>pip install uwsgi
>>>cp /usr/lib/python2.7/site-packages/uwsgi /usr/sbin/
测试uWSGI安装是否正常
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return ["Hello World"]
>>>uwsgi --http :8000 --wsgi-file test.py
http://example.com:8000
测试django项目是否正常
>>>python manage.py runserver 0.0.0.0:8000
>>>uwsgi --http :8000 --module mysite.wsgi