Gunicorn ImportError: No module name app only when directory name is site

Viewed 839

Trying to get gunicorn runing with a hello world app.
This is my project directory structure

Project
  |_ config
  |  |_ ___init__.py
  |  |_ settings.py
  |
  |_ instance
  |  |_settings.py_production
  |
  |_ site
  |  |_ __init__.py
  |  |_ app.py
  |
  |_ .env
  |_ docker-compose.yml
  |_ Dockerfile
  |_ requirements.txt

I am running this in a docker container but when I go into the container in interactive mode the same behaviour occurs.

When the directory is named site and I run the command gunicorn -b 0.0.0.0:8000 --access-logfile - "site.app:create_app()" I get an error ImportError: No module name app. However if I name the directory foo, snakeeyes or blah I do not recieve an error and the app runs as expected. Is there a reason for this? Can directories not be named site? Are there any other restreicted direcory names in python?

1 Answers
Related