[Answered ]-Google App Engine + Django with multiple apps within project = ImportError

2πŸ‘

Solved it myself! This turned out to be a configuration error on my part. When you have a Django project with multiple apps, the app.yaml file needs to be β€œoutside” the project directory. In other words, the app.yaml file needs to be sitting next to manage.py instead of next to settings.py. That way, all the apps in your project will automatically get included in the PYTHONPATH.

Note: You may also need to add the following 2 lines to app.yaml:

env_variables:
    DJANGO_SETTINGS_MODULE: 'myproj.settings'
πŸ‘€melsam

0πŸ‘

This is not typically how a django project is organized.

Right now, your app is living inside the project. Those should instead be living side by side.

Assuming your project is named proj and your app app, this is what your directory layer should look like:

.
β”œβ”€β”€ manage.py
β”œβ”€β”€ app
β”‚Β Β  β”œβ”€β”€ __init__.py
β”‚Β Β  β”œβ”€β”€ admin.py
β”‚Β Β  β”œβ”€β”€ models.py
β”‚Β Β  β”œβ”€β”€ tests.py
β”‚Β Β  └── views.py
└── proj
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ settings.py
    β”œβ”€β”€ urls.py
    └── wsgi.py
πŸ‘€Thomas Orozco

Leave a comment