0
votes

Using PyCharm and following a step-by-step guide for setting up a cookiecutter Django project. Can't seem to get past the migrate command.

This is my first time using the cookiecutter project template and I haven't had issues before when creating projects from scratch. Not sure what the issue is but it looks like it may be related to the INSTALLED_APPS, but I haven't modified any of the files from the template.

Error is listed below:

"C:\Program Files\JetBrains\PyCharm 2018.3\bin\runnerw64.exe" C:\Users\willi\AppData\Local\Programs\Python\Python36-32\python.exe "C:\Program Files\JetBrains\PyCharm 2018.3\helpers\pycharm\django_manage.py" migrate C:/Users/willi/PycharmProjects/fishgutz Tracking file by folder pattern: migrations Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2018.3\helpers\pycharm\django_manage.py", line 52, in run_command() File "C:\Program Files\JetBrains\PyCharm 2018.3\helpers\pycharm\django_manage.py", line 46, in run_command run_module(manage_file, None, 'main', True) File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 205, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:/Users/willi/PycharmProjects/fishgutz\manage.py", line 30, in execute_from_command_line(sys.argv) File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management__init__.py", line 371, in execute_from_command_line utility.execute() File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management__init__.py", line 365, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management__init__.py", line 216, in fetch_command klass = load_command_class(app_name, subcommand) File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management__init__.py", line 36, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\importlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked
File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\migrate.py", line 12, in from django.db.migrations.autodetector import MigrationAutodetector File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\autodetector.py", line 11, in from django.db.migrations.questioner import MigrationQuestioner File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\questioner.py", line 9, in from .loader import MigrationLoader File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\loader.py", line 8, in from django.db.migrations.recorder import MigrationRecorder File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\recorder.py", line 9, in class MigrationRecorder: File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\recorder.py", line 22, in MigrationRecorder class Migration(models.Model): File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 100, in new app_config = apps.get_containing_app_config(module) File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 244, in get_containing_app_config self.check_apps_ready() File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 127, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

Process finished with exit code 1

Expected: postgres database configures and I can then runserver

2

2 Answers

0
votes

Are you using separated settings module? If you are, you must export DJANGO_SETTINGS_MODULE=<your_settings_module>

For example, when your settings separated byprod/settings/local.py and prod/settings/deploy.py

export DJANGO_SETTINGS_MODULE=prod.settings.local

or

export DJANGO_SETTINGS_MODULE=prod.settings.deploy

0
votes

I redid the process but chose NOT to include Celery and the migration and server ran successfully. I believe that app was not set up in entirety and was throwing off the project. To avoid continued headache, I chose to exclude it for now in the new setup. Thank you for the help @Yongjin Jo!