Xin Hai
Xin Hai

Reputation: 1

raise AppRegistryNotReady Error when run django models.py using pycharm

I am a new django, I am trying to write a post api, but when I run the models.py using pycharm, there is an error about class Event(models.Model). the error details as below.

Traceback (most recent call last): File "F:/Auto_Projects/pydj/guest/sign/models.py", line 6, in class Event(models.Model): File "C:\Python27\lib\site-packages\django\db\models\base.py", line 110, in new app_config = apps.get_containing_app_config(module) File "C:\Python27\lib\site-packages\django\apps\registry.py", line 247, in get_containing_app_config self.check_apps_ready() File "C:\Python27\lib\site-packages\django\apps\registry.py", line 125, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

django version:1.11.14 python version:2.7

INSTALLED_APPS = [
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'sign', 
  'bootstrap3',
]

My app name is 'sign', and I have added the 'sign' to the INSTALLED_APP of the settings.py.

Upvotes: 0

Views: 150

Answers (1)

2ps
2ps

Reputation: 15956

In django you run manage.py not models.py. e.g.,

python manage.py runserver

Upvotes: 0

Related Questions