I’m using heroku and django / vertualenv … I used this boostrap file: https://github.com/mtigas/heroku-django-demo-app/blob/master/tldr.markdown, named my app contest2 but when I try to run foreman locally with foreman start I get:
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
11:10:06 web.1 | ImportError: Could not import settings 'src/contest2/contest2/settings.py' (Is it on sys.path?): Import by filename is not supported.
From the dir the procfile is in, this path: src/contest2/contest2/settings.py is correct.
My procfile looks like this:
web: gunicorn_django -b 0.0.0.0:$PORT -w 9 -k gevent --max-requests 250 --preload src/$PYTHON_APP_NAME/$PYTHON_APP_NAME/settings.py > Procfile
Thanks for your help in advance.
Your
src/contest2/contest2/settings.pyis fed to the__import__function.You can try to simulate the error:
You probably want to change that to have the python module name and not the path.
The easier way would be to make sure that
src/$PYTHON_APP_NAME/$PYTHON_APP_NAME/is on your path, and just usesettingsas module name.You might want to have a look at the source of the
gunicorn_djangocommand to figure out how this works: