请使用conda创建新的环境
conda env create -f .\environment.yml
- 获取
docker pull xdcat/centos:ponsol2
- 运行
docker run -tid -p8091:3306 -p8090:80 --name ponsol2 --privileged=true xdcat/centos:ponsol2 /usr/sbin/init
- 网站将会在8090端口运行
-
使用 conda 创建新的环境,如上所示
-
迁移数据库
- 修改数据库配置:
- db.config 实际环境
- db_dev.config 开发环境
- 使用 makemigrations 和 migrate 迁移数据
- 修改数据库配置:
-
确保项目能够正常运行
python manage.py runserver
-
使用 uwsgi 部署
-
安装 uwsgi
pip install uwsgi --upgrade
-
迁移静态文件
- 修改迁移后路径,在setting.py中修改
STATIC_ROOT = '/srv/django/ponsol2/static'
- 迁移
python ./manage.py collectstatic
- 修改迁移后路径,在setting.py中修改
-
修改配置文件
- 将 setting.py 的
DEBUG
修改为False
- 修改 uwsgi.ini 的
chdir
和static-map
(迁移后路径)
- 将 setting.py 的
-
- 运行
nohup /root/anaconda3/bin/uwsgi --ini /root/box/Ponsol_Web/uwsgi.ini > run_ponsol2_uwsgi.log 2>&1 &