Forums

ModuleNotFoundError: No module named 'mysite.settings.production'; 'mysite.settings' is not a package

I created a project in pythonanywhere with django 2.1, default sqlite 3, and virtualenv

(django2) 16:59 ~/mysite $ pip freeze -f /usr/share/pip-wheels Django==2.1.2 pytz==2018.5

my structure is: one project named mysite and one app name cadastro (django2) 17:00 ~/mysite $ tree . ├── cadastro │ ├── init.py │ ├── pycache │ │ ├── init.cpython-36.pyc │ │ ├── urls.cpython-36.pyc │ │ └── views.cpython-36.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── init.py │ ├── models.py │ ├── templates │ │ └── cadastro │ │ ├── base.html │ │ └── cadastro.html │ ├── tests.py │ ├── urls.py │ └── views.py ├── db.sqlite3 ├── manage.py ├── media ├── mysite │ ├── init.py │ ├── pycache │ │ ├── init.cpython-36.pyc │ │ ├── settings.cpython-36.pyc │ │ ├── urls.cpython-36.pyc │ │ └── views.cpython-36.pyc │ ├── settings.py │ ├── templates │ │ └── mysite │ │ ├── base.html │ │ └── home.html │ ├── urls.py │ ├── views.py │ └── wsgi.py └── static └── admin [...]

and mysite/settings.py has the app declared ... INSTALLED_APPS = [ 'cadastro.apps.CadastroConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ]

When i run ./manage.py makemigrations is returned a extensive log finally with ModuleNotFoundError: No module named 'mysite.settings.production'; 'mysite.settings' is not a package

Any suggestion for this?

mysite.settings is a single file. For there to be a mysite.settings.production, there would need to be a settings directory with at production.py in it. Use mysite.settings instead of mysite.settings.production.

Thanks for help.

I´m too founded response on that link https://simpleisbetterthancomplex.com/tips/2017/07/03/django-tip-20-working-with-multiple-settings-modules.html

OK -- is everything working OK now?