Django troubleshooting

Overview

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 server upgrades

DreamHost frequently upgrades the operating systems on its web servers to ensure security and provide upgraded software. The following article explains how you can view the current operating system your server uses.

The recommended way to install Django is in a virtual environment:

After a server upgrade, it may be necessary to reinstall your virtual environment and Django project to resolve any conflicts.

Confirm credentials are correct

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.

Kill existing processes

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. Make sure to change username to your Shell user.

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

If you find this did not work, Contact support for further assistance.

Re-save your domain settings in the panel

If your domain is hosted on a VPS or dedicated server, you could also reload HTTP in the panel.

  1. Navigate to the VPS or Dedicated page.
    reload http button
  2. Click the Reload HTTP button.
  3. Wait 5 minutes for it to rebuild the configuration file.

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

Premature end of script headers

If you're seeing "Premature end of script headers" in your sites error log, view the following article to confirm your passenger_wsgi.py file is correctly configured:

404 error on admin page

When visiting your example.com/admin/ page, you may see a 404 error.

404
"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/example.com/public/admin

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?