作者jiaan5566 (oiga por favor)
看板Python
标题[问题] Django + uwsgi + lighttpd
时间Mon Jul 8 23:35:37 2019
最近在自学 Django rest framework 并尝试把它搭配到目前已有的 lighttpd 运行
网路上大部分都是资源都是搭配 nginx 自己摸索一下後总算是运行起来(?)
但是有点奇怪,我的api
http://ip-address/api/faceitems
python3 manage.py runserver 0.0.0.0:8000 的情况下
ip-address:8000/api/faceitems 是正常运作的
但如果是透过 uwsgi + lighttpd 运行
ip-address/api/faceitems 却会404 not found
从django 的 debug message看起来是有进去的
https://i.imgur.com/eYt9koz.jpg
但不知道为什麽current path 会变成少了/api 导致404
如果在 /api 前面加上任意路径 例如 123/api/faceitems 就可以了!
感觉就是会吃掉一段 /XXX/
不确定是我运行方式有误? 或是配置档不正确
lighttpd.conf :
server.modules += ( "mod_scgi" )
$HTTP["url"] =~ "^/api/" {
scgi.protocol = "uwsgi"
scgi.server = (
"/" => (( "host" =>"127.0.0.1","port"=>"8000","check-local"=>"disable" )),
)
}
uwsgi :
uwsgi --socket 127.0.0.1:8000 --module mysite.wsgi
django rest framework 的部分是参照官网和下面的教学设定的
https://github.com/twtrubiks/django-rest-framework-tutorial
请问是哪里做错了呢?
超级新手 还请各位不吝指教
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.45.99.71 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1562600139.A.B9C.html
1F:→ f496328mm: 我是用 django + nginx + uwsgi ,蛮复杂是真的 07/08 23:53
2F:推 froce: 你可以用uwsgi先直接开个测试server去看是不是lighthttpd的 07/09 16:43
3F:→ froce: 问题 07/09 16:43
4F:→ froce: 不过lighttpd我就真的不熟了 07/09 16:44
5F:→ scott90213: 直接测试是没问题的 加上lighttpd 就异常 07/10 11:01