2017-03-28 1 views
0

앱이 아직로드되지 않았습니다. 오류가있는 django 애플리케이션이 있습니다. 나는 포스트 그레스 DB를 사용하고있다. 모델을 추가 한 후 문제가 발생하기 시작했습니다. 나는 모델을 설치된 애플 리케이션에 추가하려고 시도했다. 장고 설치를 모델 아래로 변경하고, 모델 클래스에 이름을 추가하고, 모델 클래스에 메타를 추가했다. django.db 가져 오기 모델을 사용하는 데 문제가 있는지 확실하지 않습니다.장고 앱이 아직로드되지 않았습니다

여기 당신이의 myapps '단지'의 myapps '대신 추가해야한다고 생각 전체 오류

raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps arne't loaded yet. 

settings.py

import os 


SECRET_KEY = 'secret_key' 

# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 


# Quick-start development settings - unsuitable for production 
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ 

# SECURITY WARNING: keep the secret key used in production secret! 


# SECURITY WARNING: don't run with debug turned on in production! 
DEBUG = True 

ALLOWED_HOSTS = [] 


# Application definition 

INSTALLED_APPS = [ 
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'django.contrib.gis', 
    'django.contrib.sites', 
    'myapps.modelapp' 
] 

modelapp.py

from django.db import models 
from django.contrib.postgres.fields import ArrayField 

class AppClass(models.Model): 
    name = 'modelapp' 
    verbose_name = 'modelapp' 
    # Regular Django fields corresponding to the attributes in the 
    # world borders shapefile. 
    data_1 = models.CharField('data_1', max_length=30) 

    # Returns the string representation of the model. 
    def __str__(self):    # __unicode__ on Python 2 
     return self.parcel_own 

    class Meta: 
     managed = True 
     db_table = 'table_name' 
+1

* 전체 * 추적을 표시하십시오. 'myapps.modelapp'를'INSTALLED_APPS'에 추가하는 것은 잘못된 것 같습니다. 앱 또는 앱 설정을 'INSTALLED_APPS'에 추가해야합니다. 'modelapp.py'는 무엇이되어야 하는가? 모델이 포함되어 있다면 왜 모델명을'models.py'라고하지 않을까요? – Alasdair

답변

1

입니다. INSTALLED_APPS에서 'modelapp'을 (를) 찾습니다.

관련 문제