开发者

Weird Django URL behavior

开发者 https://www.devze.com 2023-04-05 18:47 出处:网络
I have the following URL co开发者_开发技巧nfs: urls.py: # ... url(r\'^test$\', \'project.main.views.test\', name=\'test\'),

I have the following URL co开发者_开发技巧nfs:

urls.py:

# ...
url(r'^test$', 'project.main.views.test', name='test'),
url(r'^app', include('project.app.urls')),

app/urls.py:

# ...
url(r'^$', 'project.app.views.home', name='home'),

When navigating to example.com/test I get the proper view. But when naivgating to example.com/app I get a 404. APPEND_SLASH is set to TRUE, if it matters.

Fixing all my URLs to end with a slash solves this, but I rather not have my URLs with those useless slashes at the end.

What am I missing?


It turns out there's some corrupt module in my PYTHONPATH which somehow messes up the entire url conf.

When working from a clean environment (i.e. using virtualenv), everything works great.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号