Update "Django Tutorial Part 2: Creating a skeleton website" page to prevent a bug in "Django Tutorial Part 8: User authentication and permissions" #39129
Conversation
|
@hamishwillee - PR here for you to have a look at when you have time 👀 |
Move the catalog as the first line in the installed app to override default behavior
|
@LittleBangTheory Firstly, thank you for posting this issue and for posting a solution as a PR. That makes it much easier to evaluate. My problem with this is that
So we know that if you follow the instructions properly the code will work. It is true that Django looks at INSTALLED_APPS, but that isn't the full story. Django follows this order:
The admin part of the site will be looking for the more specific path like admin/registration/logged_out and will not be found in the templates you specify. I don't really want to make this change because while it might be a little "safer", it isn't the right way to manage finding templates. If we did do this we'd have to update the app https://github.com/mdn/django-locallibrary-tutorial and fully test it first. Therefore I am going to close this. But will reopen if you strongly disagree. Thank you again for contributing, and apologies for not getting to this earlier. |
Move the catalog as the first line in the installed app to override default behavior
Description
I moved
'catalog.apps.CatalogConfig',as the first line ofINSTALLED_APPSin the setup of the Django skeleton website tutorial, and made the following change in the description just above and below the code section.Motivation
When implementing the part 8 of the tutorial, I ran into an issue : the
logged_out.htmlpage I set up wasn't overriding the default Django page, which meant that when using the log out form in the tutorial, I was sent to the admin console logout page instead of mine.I found that it was because the order of applications in the settings mattered, so I needed to move my app the top of my list. I hope this change will avoid others the same headache as me !
English is not my first language, so my apologies if there are any mistakes in the way I rewrote the description :)
Additional details
I found the solution here, which is coherent with Django Documentation :
Related issues and pull requests
None that I could find.