Django troubleshooting


This article lists a few troubleshooting steps you can take with Django.

To run the commands in this article, you must log into your server via SSH with your Shell user. View the following articles for more information:

Errors due to Ubuntu upgrades

DreamHost recently upgraded web servers to use a newer version of Ubuntu. With the new version of Ubuntu comes a newer version of Django. If you previously installed your version of Django using the old install script, you could potentially see errors with your website. Unfortunately, technical support is unable to assist with any older installation errors.

The only recommended way to currently install Django is in a virtualenv.

Application isn't working

If your application isn't working, make sure you’re using the correct usernames, passwords, database names, and hostnames in the /projectname/ file.

If you make changes to the code, such as working through the official tutorials, and they don't seem to work, make sure to kill any existing Python processes and reload the page:

[server]$ pkill python

Changes are not reflected

If you modified your application and your changes do not seem to be reflected, you may need to notify Passenger about your change by creating or modifying ~/ Make sure to change username to your Shell user.

[server]$ touch /home/username/
Passenger looks for this file and reloads the application when this file is modified.

Shared Hosting changes are not reflected

If you're using Shared Hosting and your changes do not seem to be reflected, you can notify Passenger about your change by running the following command:

[server]$ touch

Custom Python version

If you installed a custom version of Python in your directory and you'd like to use it, add the following to your file:

if sys.hexversion < 0x2060000: os.execl("/path/to/your/copy/of/python2.7", "python2.7", *sys.argv)

500 error

If you're getting meaningless 500 pages even though you have DEBUG enabled in your Django app, you're probably running into a Passenger problem dealing with errors. View the 500 Errors with Passenger WSGI Workaround article for details.

If you're following the Django tutorial or migrating an existing project, you may get "Premature end of script headers" in your sites error log. This may be due to the Passenger file not including your project directory in its path. One solution is to open and add the following:


404 error on admin page

When visiting your page, you may see a 404 error.

"The requested URL /admin/ was not found on this server"

Checking your error.log file, you may see the following:

File does not exist: /home/username/

If you're sure there is no issue with your code, make sure your website is under a username that is not being used for anything else, such as another website or application code.

Splitting out the Django website under its own unique username should resolve this issue.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?