Opened 2 years ago

Closed 2 years ago

#18948 closed Bug (worksforme)

setting DEBUG to False change behavior of i18n

Reported by: lanyjie Owned by: nobody
Component: Translations Version: 1.4
Severity: Normal Keywords: i18n integration
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I pretty much followed the i18n tutorial setup:

urlpatterns += i18n_patterns('', url(r'', include(my_urls))

and when settings.DEBUG = True, if visit

http://my.web.site/

the server will first send out a http/1.1 302 response, then the browser would immediately send a new request of something like:

http://my.web.site/en/

depending on the default language of the browser, which is the expected behavior. But when I set DEBUG=False, the server would then directly send out a 500 response, which seems just wrong.

Change History (3)

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

The problem here is that you probably have no 404.html in your template folder, hence the code path is generating a server error (500) when DEBUG is False. You could probably have seen an appropriate message in your server's logs.

This leads me to wonder why we don't have a default 404 content when there is no 404 template. Is this design decision documented somewhere?

comment:2 Changed 2 years ago by aaugustin

Providing a default 404 content is tracked in #18807.

comment:3 Changed 2 years ago by lanyjie

  • Resolution set to worksforme
  • Status changed from new to closed

@claudep: indeed, after providing 404.html everything worked just fine. Thanks!

Note: See TracTickets for help on using tickets.
Back to Top