V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
csdreamdong
V2EX  ›  问与答

请教一个 nginx+uwsgi+django 的问题

  •  
  •   csdreamdong · 2016-07-05 15:42:51 +08:00 · 1369 次点击
    这是一个创建于 2842 天前的主题,其中的信息可能已经有所发展或是发生改变。
    nginx 的配置:
    
    server {
        listen       80;
        server_name  www.hehehe.com;
    
        charset utf-8;
    
        location /test {
            include uwsgi_params;
            uwsgi_pass 127.0.0.1:3031;
        }
    
    }
    
    uwsgi 的配置
    
    [uwsgi]
    uid = uwsgi
    gid = uwsgi
    socket = 127.0.0.1:3031
    chdir = /data/workspace/mblog
    env = DJANGO_SETTINGS_MODULE=mblog.settings
    module = django.core.wsgi:get_wsgi_application()
    logto = /var/log/mblog/uwsgi.log
    enable-threads = true
    processes = 2
    threads = 2
    master = true
    
    
    djang url 的配置
    
    urlpatterns = [
        url(r'^index/', include('index.urls')),
        url(r'^admin/', admin.site.urls),
    ]
    
    
    访问 http://www.hehehe.com/test/index 会进入到 django 的流程里没有错。
    但就是提示, The current URL, test/index/, didn't match any of these.
    问题就应该出在了 django 的 url 匹配问题上。
    
    nginx 把 /test ,反向代理到了 uwsgi 里。。但 django 中 url 匹配的时候还是算上了 /test
    
    同样的方式。。 apache 的, wsgiscriptalias ,就不会有问题。。求助怎么破。
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3518 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:25 · PVG 19:25 · LAX 04:25 · JFK 07:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.