Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django应用程序是';还没装呢_Django_Model - Fatal编程技术网

Django应用程序是';还没装呢

Django应用程序是';还没装呢,django,model,Django,Model,我有一个django应用程序,错误是尚未加载应用程序。我用的是postgres数据库。在我添加了一个模型后,问题开始出现。我尝试将模型添加到已安装的应用程序中,将django设置更改为模型下方,将名称添加到模型类中,将元添加到模型类中。我不确定使用django.db导入模型是否存在问题 下面是全部错误 raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: A

我有一个django应用程序,错误是尚未加载应用程序。我用的是postgres数据库。在我添加了一个模型后,问题开始出现。我尝试将模型添加到已安装的应用程序中,将django设置更改为模型下方,将名称添加到模型类中,将元添加到模型类中。我不确定使用django.db导入模型是否存在问题

下面是全部错误

raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps arne't loaded yet.
设置.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'

我认为你应该在已安装的应用程序中只添加“myapps”而不是“myapps.modelapp”。

我认为你应该在已安装的应用程序中只添加“myapps”而不是“myapps.modelapp”。

请显示完整的回溯。将
myapps.modelapp
添加到
INSTALLED\u APPS
看起来非常错误。您应该将应用程序或应用程序配置添加到已安装的应用程序中。
modelapp.py
应该是什么?如果它包含模型,那么为什么不将其命名为
models.py
?请显示完整的回溯。将
myapps.modelapp
添加到
INSTALLED\u APPS
看起来非常错误。您应该将应用程序或应用程序配置添加到已安装的应用程序中。
modelapp.py
应该是什么?如果它包含模型,那么为什么不将其命名为
models.py