1

I am Django newbie and I am trying to deploy my app to Heroku. It works fine when DEBUG = True (django handles static files). But now I'm setting DEBUG = false and trying to get Heroku to handle static files, but I'm hitting an error.

As per this blog and the answer for this question, I added this to my Procfile and added the required settings to my settings.py:

web: python my_django_app/manage.py collectstatic --noinput; bin/gunicorn_django --workers=4 --bind=0.0.0.0:$PORT my_django_app/settings.py

But when I push my app, it crashes and I see this in the heroku logs:

2012-03-23T21:55:57+00:00 app[web.1]: ImportError: Could not import settings 'my_django_app/settings.py' (Is it on sys.path?): Import by filename is not supported.
Community
  • 1
  • 1
Aswath Krishnan
  • 1,131
  • 1
  • 9
  • 16

2 Answers2

3

The settings path should be a Python module path, not a filesystem path. my_django_app.settings is probably what you want.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • Thanks! I tried that as well, but I get this error: `module not found 2012-03-25T00:52:44+00:00 app[web.1]: raise ImportError("Could not import se ttings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e)) 2012-03-25T00:52:44+00:00 app[web.1]: ImportError: Could not import settings 'my_django_app.settings' (Is it on sys.path?): No module named my_django_app.settings` – Aswath Krishnan Mar 25 '12 at 00:54
0

Most like the problem here is your django app name is not "my_django_app". Make sure you replace "my_django_app" with your app name.