Why does Python/Django keep redirecting to url 'catalog'?
Asked Answered
A

1

7

I'm stepping into the Python world. First I learned a little Python. Then I learned the basics of Django, and on top of that I'm learning Wagtail (framework for template managing for Django)

To learn Django a went through a tutorial to build a site locally and test it in 127.0.0.1:8000.

At some point of the tutorial I configured the settings (because the tutorial said so) to redirect to 127.0.0.1:8000/catalog when browsing to 127.0.0.1:8000 alone.

Then I started the Wagtail tutorial, as a completely different project in another folder. Not sharing any code with the tutorial Django project.

I run the server and the console says it is now running in port 127.0.0.1:8000 and when I browse it, it redirects me to /catalog and of course shows a Page not found error since this project doesn't have one app catalog.

I workaround this by opening Chrome in Incognito Mode. But still I would like to know why this is happening and how to solve it to add to my knowledge of how Python works.

Some notes:

  • I'm on Windows
  • I killed all processes related to Python and actually this is still happening after turning my PC off and on
  • I know I could use a different port, please do not give me that answer. My goal is to learn.
Agonized answered 10/3, 2017 at 14:14 Comment(0)
R
16

Try clearing your browser cache.

The problem is most likely that your browser has cached a 301 Moved Permanently for 127.0.0.1:8000, thus never hit your development server when you enter the URL, but simply do the redirect based on the cache.

You will see the same result no matter what you're running behind port 8000, and it's as such not related to Django.

Riesling answered 10/3, 2017 at 14:24 Comment(7)
The curious part is that when this happened I switched to Firefox because I was sure it was only browser-related. But in Firefox happened exactly the same, even though I didn't open Firefox for the Django project! That's why I thought it might be related to some Python process sort ofAgonized
That sounds weird. Did it work after clearing the browser cache?Riesling
Based on your answer I googled a little bit and I was able to clean the chache making it work :) So, your answer it pretty much the info I neededAgonized
Cache was exactly my problem. I've spent hours trying to figure out why it was redirecting. Thanks!Lanark
Thanks @Riesling ! I spent a long time trying to figure out what was going on. I followed this suggestion on how to clear the cache in Chrome. But I had to select the "All time" option there to make it work. The "Last hour" option was not enough, since I had been working for a while in the project.Excommunicative
Note: You can solve this without clearing all your data easily by using the "Disable cache" option in the devtools. See: #9130922Koa
Another simple solution is just to add two forward-slash as in: 127.0.0.1:8000/Supersensitive

© 2022 - 2024 — McMap. All rights reserved.