Opened 7 years ago

Closed 7 years ago

#28464 closed Bug (invalid)

How to prevent URLconf settings from being carried onto new project?

Reported by: Mike Lee Owned by: nobody
Component: contrib.redirects Version: 1.11
Severity: Normal Keywords: localserver, URLconf
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 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?

Attachments (1)

404.JPG (90.5 KB ) - added by Mike Lee 7 years ago.

Download all attachments as: .zip

Change History (2)

by Mike Lee, 7 years ago

Attachment: 404.JPG added

comment:1 by Tim Graham, 7 years ago

Resolution: invalid
Status: newclosed

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.

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