操作系统: Ubuntu / 16.04 LTSamd64 (64bit)
Python版本: 3.5.2
Django版本: 2.0.4
nginx版本: 1.10.3
安装pip3(python3 的pip)
sudo apt-get install python3-pip
安装uwsgi
pip3 install uwsgi
测试uwsgi运行状态
新建文件test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"]
使用uwsgi运行该文件
uwsgi --http :8000 --wsgi-file test.py
访问页面
可以看到亲切的hello world 就说明uwsgi运行成功了
上传项目代码
git clone https://gitee.com/gy071089/SecurityManageFramwork.git
确认代码运行正常
进入项目目录,导入所需包:
python3 manage.py makemigrations //初始化数据表
python3 manage.py migrate //初始化数据库
python3 manage.py createsuperuser创建超级账号
初始化权限信息(主要包含菜单,权限以及管理员角色信息,该信息可在后台调
整)
python3 initdata.py
python3 manage.py runserver 0.0.0.0:8000 运行项目
访问
uswgi运行项目
uwsgi --http :8000 --chdir/root/SecurityManageFramwork --wsgi SeMF.wsgi --static-map=/static=static
让uwsgi后台运行
配置nginx
将项目中静态文件资源,复制到/var/www目录下
保存重启nginx。访问网站: