Search code examples
djangofirefoxhttp-status-code-301django-urls

Django: Why can't I get my development server to work?


I'm on Windows XP with the latest install of Python 2.6 (and the development server has been working up until last night). I have the path and Python path stuff all set up, and my dev server has worked forever. I recently replaced my django-trunk with a new pull from the Django trunk. I thought maybe there was an import error or something that Django wouldn't catch in one of my app's models.py so I started a new project (empty but just for testing) and it still didn't work. I restarted my computer and tried the new empty app again python manage.py runserver 8080 and went to http://127.0.0.1:8080/ and it worked ("Congrats. Django is insta..."). So I CD over to my real project and tried again and it didn't work. I'm not getting a stack trace or anything like that. I either get [17/Ja/2010 16:30:51] "GET / HTTP/1.1" 301 0 as output when I visit http://127.0.0.1:8080/ in my CMD prompt or I get nothing (even if I hard refresh, etc). What could this be?

Update (Important):

Firefox tells me Firefox can't find the server at www.127.0.0.1. even though I'm at http://127.0.0.1:8080/. Does this mean that Django is really sending a 301 to www.127.0.0.1 for some other reason?

I removed PREPEND_WWW from settings.py, and even removed all the apps (except for the django admin and preset ones) that were installed in settings.py.

Update 2: It works in Safari! How can this be? It's like Firefox is getting some sort of 301 but Safari works just fine.


Solution

  • yep, 301 permanent redirect is remembered by firefox, i've been stuck once on that one, restarting or cleaning history/cache didn't help, so i just ran it on another port.

    edit after commenting:

    assuming you use some localhost_settings.py to setup your project locally and still want to www_redirect on the production website:

    try:
        from localhost_settings import *
        PREPEND_WWW = False
    except ImportError:
        PREPEND_WWW = True
    

    i do it this way