作者redbxh (LJC)
看板Python
标题[问题] 把django deploy 到 apache
时间Thu Jan 18 17:22:54 2018
大家好
最近在帮忙写官网 於是就用了 python3.6.4 + django 2.0 来写
我一直以来的经验都只有deploy 到 heroku aws 等 搭配的是uwsgi
而要使用的 server 版本也有点旧 .
ubuntu 12.04 + apache 2.2
光是 python3.6.4 就要自己编译 不能 apt-get install
根据官网
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/modwsgi/
的步骤做 卡在 virtual_env 的问题
也试过用 daemon mode
但都无法成功 work
请问大家有 deploy 的相关经验能协助
或是 可以有更简易的组合及设定能完成 deploy 吗?
apache + uwsgi or apache + gunicorn 等
-----
apache conf
<Directory /home/usr/project_name/project_name>
<Files wsgi.py>
Order deny,allow
Deny from all
</Files>
</Directory>
WSGIDaemonProcess site python-path=/home/usr/site
WSGIProcessGroup site
WSGIScriptAlias /newsite/ /home/usr/project_mame/project_name/wsgi.py
-----
我如果写 python-home 将 virtual enviroment 加入会过不了 configtest
连 127.0.0.1 显示 apache 的 it works page
但连 127.0.0.1/newsite/ 会显示 403 forbidden
log: client denied by server configuration: xxxxxx/xxxxxx/wsgi.py
-
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.251.126.103
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1516267380.A.3CB.html
1F:→ djshen: 为什麽要deploy到local? 01/18 17:37
2F:→ redbxh: 我可能形容错了 就是要在一台ubuntu 12.04 的机子上 run 01/18 17:51
※ 编辑: redbxh (60.251.126.103), 01/18/2018 17:51:43
3F:推 Sunal: 没关系centos7也是要自己make XD 01/18 17:57
4F:→ redbxh: 目前能 run develop server 但跟apache 串接一直没搞好 01/18 17:59
※ 编辑: redbxh (60.251.126.103), 01/18/2018 18:06:29
5F:→ uranusjr: 有什麽理由一定要用 Apache 吗?Apache 是出了名的难搞 01/18 18:22
6F:推 kenduest: 建议还是 nginx + uwsgi 省事方便又快 01/18 21:38
7F:→ redbxh: 最後改ubuntu 16.04 nginx。 sqlite 之外有推荐的db吗 01/19 16:29
8F:→ redbxh: 还是资料量不大的情况就sqlite? 01/19 16:29
9F:→ uranusjr: Django 官方推荐使用 PostgreSQL 01/19 18:01
10F:→ redbxh: 最後我直接使用 docker nginx+uwsgi 完成deploy 01/22 15:23