问题描述:

On my local server, when I go to the homepage by typing 127.0.0.1:8000 it automatically pushes me to /en/ like I want it to.

On my production server it drops me in '/' which gives me a 404 error. Oddly enough any of the link i click on in my 404 page which still has the site header will take me to the /en/ urls and then everything works fine.

Did I miss something here? Why isn't it redirecting me automatically?

EDIT: forgot to add the code...

from django.conf.urls.i18n import i18n_patterns

urlpatterns += i18n_patterns(

url(r'^accounts/', include('allauth.urls')),

url(r'^forum/', include('djangobb_forum.urls', namespace='djangobb')),

url(r'^blog/', include('blog.urls', namespace='blog')),

url(r'^', include('main.urls')),

)

EDIT: semi solved....

ok so after much trial and error I found that it was coming from having custom 404 and 500 templates, I have no clue why and I would really like to try and keep my custom templates... Any ideas?

网友答案:

It was the custom 404 and 500 handler lines that the docs say to add to urls.py. I think I only needed these if I wanted some special behavior on a 404 and 500 past a custom template. I took out the views and the handlers in urls.py and left the 404.html and 500.html templates in the templates folder and everything works as I would want it to...

相关阅读:
Top