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.
Abbas
  • 3,872
  • 6
  • 36
  • 63
user1869935
  • 717
  • 2
  • 10
  • 23

1 Answers1

15

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.

decibyte
  • 773
  • 11
  • 17
  • 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 of – user1869935 Mar 10 '17 at 14:28
  • That sounds weird. Did it work after clearing the browser cache? – decibyte Mar 10 '17 at 14:29
  • 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 needed – user1869935 Mar 10 '17 at 14:33
  • 1
    Cache was exactly my problem. I've spent hours trying to figure out why it was redirecting. Thanks! – J0ANMM Nov 13 '18 at 09:39
  • Thanks @decibyte ! I spent a long time trying to figure out what was going on. I followed [this suggestion](https://support.google.com/accounts/answer/32050?co=GENIE.Platform%3DDesktop&hl=en) 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. – Michel Mesquita Sep 21 '20 at 11:11