作者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://www.ptt.cc/bbs/Python/M.1516267380.A.3CB.html
→ djshen: 為什麼要deploy到local? 01/18 17:37
→ redbxh: 我可能形容錯了 就是要在一台ubuntu 12.04 的機子上 run 01/18 17:51
※ 編輯: redbxh (60.251.126.103), 01/18/2018 17:51:43
推 Sunal: 沒關係centos7也是要自己make XD 01/18 17:57
→ redbxh: 目前能 run develop server 但跟apache 串接一直沒搞好 01/18 17:59
※ 編輯: redbxh (60.251.126.103), 01/18/2018 18:06:29
→ uranusjr: 有什麼理由一定要用 Apache 嗎?Apache 是出了名的難搞 01/18 18:22
推 kenduest: 建議還是 nginx + uwsgi 省事方便又快 01/18 21:38
→ redbxh: 最後改ubuntu 16.04 nginx。 sqlite 之外有推薦的db嗎 01/19 16:29
→ redbxh: 還是資料量不大的情況就sqlite? 01/19 16:29
→ uranusjr: Django 官方推薦使用 PostgreSQL 01/19 18:01
→ redbxh: 最後我直接使用 docker nginx+uwsgi 完成deploy 01/22 15:23