环境:Python 3.8.1 + Django 2.2.12
为整合流程规范,部署了综合型的项目,包含了 task (需求系统),doc (文档系统),sso (单点登录系统),
大致的目录结构:
CellMiddle -- 项目根目录
├─task --- 需求系统
│ ├─migrations
│ ├─static
│ └─templates
├─logs --- 日志目录
├─doc --- 文档系统
│ ├─data
│ ├─migrations
│ ├─static
│ └─templates
├─sso --- 单点登录,权限控制系统
│ ├─migrations
│ ├─static
│ └─templates
├─upload ---文件资源上传目录
├─static --- 静态资源
├─templates --- 公共模板
└─CellMiddle --- 项目主目录
│ ├─config --- 公共配置
│ ├─helper --- 公共辅助类,ex:时间,日期,字符串,响应等
│ └─loader --- 第三方库的实例化加载,ex:Redis,Memcached等
│ │ settings.py
│ │ urls.py
│ │ wsgi.py
│ │ __init__.py
├─manage.py
└─envConf -- 部署配置文件:requirement.txt, host.conf, supervisor, gunicorn 等
使用 nginx + gunicorn + supervisor 部署,使用域名 cell.hao456.com 解析指向服务器, nginx 监听 gunicorn 绑定的端口,可以正常访问:
http://cell.hao456.com/task
http://cell.hao456.com/doc
http://cell.hao456.com/sso
虽然同一个域名路由控制来访问,也是可以的。但还是想像PHP一样只要独立入口文件,每个app独立使用不同子域名,如:
http://task.hao456.com 指向task
http://doc.hao456.com 指向doc
ht