I'm building a Django app and am in the process of migrating to Heroku and Heroku Postgres. When I run "python manage.py runserver" or even "heroku run python manage.py runserver" Terminal returns the error "Error: No module named filename" - with the filename being the app folder sitting inside my main project folder that contains my models.py and views.py files etc. Please see the file structure below.
I have the app folder listed in my INSTALLED APPS and it shows up when I run "ls" for projectname so I'm puzzled as to why it can't be found.
I have started a new app using startapp and moved the contents of the old one over just to see if it was an anomaly. This only seems to have happened since trying to get Heroku working.
Here's my file structure for this project:
projectname/
manage.py
requirements.txt
Procfile
projectname/
templates/
__init__.py
settings.py
urls.py
wsgi.py
filename/
__init__.py
admin.py
models.py
tests.py
urls.py
views.py
static/
venv/
I've been struggling with this for over a day now so any help on how to get past it would be much appreciated!
EDIT: Here are all the places where I have mentioned filename in my code:
- In admin.py as 'from projectname.filename.models import *'
- In projectname/urls.py under URLconf as include('filename.urls',
'namespace=filename') - In filename/urls.py as 'from filename import *' and under URLconf as 'urlpatterns = patterns('filename.views' ...)
- In views.py as 'from filename.models import *'
I have run 'heroku run python manage.py syncdb' in venv as well and it still returns the error "Error: No module named filename".
import filename
? is it somewhere underprojectname
? – favoretti