Django troubleshooting

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 django-setup.py 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/settings.py 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 ~/example.com/tmp/restart.txt:

[server]$ touch /home/user/example.com/tmp/restart.txt
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 passenger_wsgi.py
 

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 passenger_wsgi.py 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 passenger_wsgi.py and add the following:

sys.path.append(os.getcwd()+"/<project_name>")

See also

Did this article answer your questions?

Article last updated .