1.安装anaconda配置相关python环境
2.uwsgi配置
(1)安装uwsgi
pip install uwsgi
Exception: you need a C compiler to build uWSGI
yum install -y gcc gcc-c++
(2)在django的setting文件中,添加如下内容,以支持websocket
WEBSOCKET_FACTORY_CLASS = 'dwebsocket.backends.uwsgi.factory.uWsgiWebSocketFactory'
3.nginx配置
(1)安装nginx
sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-centos-7
(2)将项目nginx配置文件加入到nginx的启动配置文件中
ln -s /your_project_nginx_path/**_nginx.conf /etc/nginx/conf.d/
(3)在django的setting文件中,注释掉STATICFILES_DIRS,添加下面一行内容:
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
运行如下命令,拉取所有需要的static file 到同一个目录:
python manage.py collectstatic
(4)运行nginx
sudo /usr/sbin/nginx