Django - 500 INTERNAL SERVER ERROR

24,015

For django v 1.5+ , in your settings.py file, Make the configuration ALLOWED_HOSTS = ['*'] if you want a quick fix

If you are really going production (and concerned about security), put allowed host names in ALLOWED_HOSTS

This SO link has more info

Setting DEBUG = False causes 500 Error

Share:
24,015
Eric Sauer
Author by

Eric Sauer

Just learning!

Updated on November 21, 2022

Comments

  • Eric Sauer
    Eric Sauer over 1 year

    What I am currently trying to do is to create a Error 404 page on my Django Server. In order to see the Error 404 page, you must turn django's debugging to off. So when I change it to "DEBUG = False" I am able to see my webpage and see the Error 404 page when going to a page that is not on the server. I went back to my main page and with Firebug realized that I was getting a

    NetworkError: 500 INTERNAL SERVER ERROR

    It is preventing me to pull data from Django. However, when I change "DEBUG = False" to "DEBUG = True". Everything works.

    Any Clue?

    edit: Full error

    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/ext-4.0.2a/resources/css/ext-all.css"

    edit edit: So I was kinda reserved with what I posted on error side. I'll take a look at the static serving however this is the full error

    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/ext-4.0.2a/resources/css/ext-
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/ext-4.0.2a/bootstrap.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/example-data.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/StatusBar.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/LiveSearchGridPanel.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/frontend.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/InspectHostPanel.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/InspectGuestPanel.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/StatusBar.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/LiveSearchGridPanel.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/frontend.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/InspectHostPanel.js"
    "NetworkError: 500 INTERNAL SERVER ERROR - http://localhost:8000/static/InspectGuestPanel.js"
    

    So its not with one certain class it an issue of not being able to pull from Django. Personally it looks like Its try to pull from the web server rather than the folders.

    • agf
      agf over 12 years
      Did you look at the logs? The console output?
    • Eric Sauer
      Eric Sauer over 12 years
      Yeah Im getting something like "[02/Aug/2011 15:02:35] "GET /p HTTP/1.1" 500 305 [02/Aug/2011 15:02:36] "GET /static/ext-4.0.2a/resources/css/ext-all.css" Thats in purple
    • John
      John over 12 years
      How are you serving the static content?
    • Chris Morgan
      Chris Morgan over 12 years
      @Eric: you can also try looking at /static/ext-4.0.2a/resources/css/ext-all.css with DEBUG = True
    • James Khoury
      James Khoury over 12 years
      Whats your urls.py file look like? I'm betting you have a if DEBUG: line in it for your static files.
    • Brandon Taylor
      Brandon Taylor over 12 years
      I second @James on this. I typically make a separate setting: SERVE_STATIC_MEDIA that I can use independently of DEBUG for that very reason.
    • James Khoury
      James Khoury over 12 years
      @brandon when i run without debug i usually am running in apache or some such webserver wich i configure to handle for me. something similar to : docs.djangoproject.com/en/dev/howto/deployment/modwsgi
    • Brandon Taylor
      Brandon Taylor over 12 years
      Yes, I do the same. Often during dev on my local box, I'll need to work with those values independently, but I never, ever serve statics through Django in production :)
    • Eric Sauer
      Eric Sauer over 12 years
      Alright, I think if figured it out... The Debug == False screws it up... almost got it to work