Aswath Krishnan
Aswath Krishnan

Reputation: 1181

Heroku Django: Handling static files. Could not import settings 'my_django_app/settings.py'

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.

Upvotes: 1

Views: 1204

Answers (2)

Daniel Roseman
Daniel Roseman

Reputation: 599966

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

Upvotes: 3

matthewphiong
matthewphiong

Reputation: 1

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.

Upvotes: 0

Related Questions