Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are several reasons why a TemplateDoesNotExist error may occur on a Django app deployed on Heroku even though it was successfully deployed locally.

  1. File paths: Heroku may have slightly different paths for the templates and static files compared to your local machine. Make sure that the file paths in your code match the paths on the Heroku server.

  2. Case sensitivity: Heroku servers may be case-sensitive when it comes to file names and paths. Double-check that your file and directory names are spelled correctly and match the case in your code.

  3. Gitignore: If you have added templates or static files to your .gitignore file, they will not be included when you deploy your app to Heroku. Ensure that your static files and templates are not being ignored in your .gitignore file.

  4. Collectstatic: By default, Heroku does not automatically run the collectstatic command when deploying a Django app. Make sure you have run python manage.py collectstatic locally and have included the resulting static files in your Git repository.

  5. Add-ons: If you are using add-ons such as Heroku Postgres or Heroku Redis, make sure they are configured correctly and are running without issues.

Overall, it's important to thoroughly test your app on the Heroku server and debug any errors that come up.