Django autoredirect to default language not work with Debug=False
I have app, with next urls.py
urlpatterns += i18n_patterns(
path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
path('admin/', admin.site.urls),
path('accounts/social/login/cancelled/', RedirectView.as_view(url='/')),
path('accounts/', include('allauth.urls')),
path('', include(cms_urls)),
)
also in settings.py I setup:
LANGUAGE_CODE = "de"
LANGUAGES = [
('de', _('German')),
# ('en', _('English')),
]
so, if DEBUG = True
when I go to /
url app automatically redirect me to '/de/', but if DEBUG = False
- app not autoredirect me to /de
, I just got 404 error
How I can manage it on production with DEBUG = False
?
I have a similar setup and it works both in debug and prod. My urls.py
is slightly different:
urlpatterns += i18n_patterns(
...
re_path('^$', index, name='root'),
re_path(r'^', include('cms.urls'))
)
index
is my home view.