[Django] #28464: How to prevent URLconf settings from being carried onto new project?

4 views
Skip to first unread message

Django

unread,
Aug 3, 2017, 1:53:21 AM8/3/17
to django-...@googlegroups.com
#28464: How to prevent URLconf settings from being carried onto new project?
-------------------------------------+-------------------------------------
Reporter: Mike Lee | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.11
contrib.redirects | Keywords: localserver,
Severity: Normal | URLconf
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I recently worked on a project that had an app named 'catalog'. While I
was working on it, I changed the URLconf so that the root URL could be
redirected to the app.

I wrote the below code to do this:
{{{
# within the project's URLconf file

from django.views.generic import RedirectView
urlpatterns += [
url(r'^$', RedirectView.as_view(url='/catalog/', permanent=True)),
]
}}}

I was working on the local development server, and the root URL
(127.0.0.1:8000) was successfully redirected to the 'catalog' app
(127.0.0.1:8000/catalog/).

However, when I created a new project, the root URL of this NEW project
ALSO tried to redirect to the 'catalog' app of the previous project.
So where as I should be seeing the "it worked!" page at the root URL for
the new project, I am instead redirected to the 'catalog' app's URL of the
previous project, where the 404 page is displayed (obviously, because the
'catalog' app is not part of the new project).

It seems to me that the settings from the previous project have somehow
affected the local server permanently so that the modified URLconf setting
is carried on to any subsequent projects.

I could not find exactly what was causing this issue so I just ran the new
project on a different port (8001) using the

{{{
python manage.py runserver 8001
}}}

command, and this seemed to fix the issue. However, I regard this only as
a temporary workaround and I want to find out the root cause of the issue.

If I can't fix it, I would like to "reset" the default port (8000) so
everything goes back to default settings.
Is there a way to completely "reset" either the local server or django
itself so that all the settings go back to how they were released?

--
Ticket URL: <https://code.djangoproject.com/ticket/28464>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 3, 2017, 1:53:46 AM8/3/17
to django-...@googlegroups.com
#28464: How to prevent URLconf settings from being carried onto new project?
-------------------------------------+-------------------------------------
Reporter: Mike Lee | Owner: nobody
Type: Bug | Status: new
Component: contrib.redirects | Version: 1.11
Severity: Normal | Resolution:
Keywords: localserver, | Triage Stage:
URLconf | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mike Lee):

* Attachment "404.JPG" added.

Django

unread,
Aug 3, 2017, 8:09:14 AM8/3/17
to django-...@googlegroups.com
#28464: How to prevent URLconf settings from being carried onto new project?
-------------------------------------+-------------------------------------
Reporter: Mike Lee | Owner: nobody
Type: Bug | Status: closed
Component: contrib.redirects | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: localserver, | Triage Stage:
URLconf | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => invalid


Comment:

Django isn't at fault: permanent redirects are cached by the browser.
Please see TicketClosingReasons/UseSupportChannels for ways to ask usage
questions, and create a Trac ticket only when you've confirmed a bug.
Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/28464#comment:1>

Reply all
Reply to author
Forward
0 new messages