Error: django.core.exceptions.ImproperlyConfigured



我正在使用django扩展来表示图模型。运行此命令时:

 $ ./manage.py graph_models -a -g -o my.png

错误:

django.core.exceptions.ImproverlyConfigure:带有大括号标签的应用程序缺少models.py模块。

我的项目结构:

Project
        app1
            models
                 abc.py
                 xyz.py
                 __init__.py
             urls.py
             admin.py
             views.py
             __init__.py
       app2
            models
                 abc1.py
                 xyz1.py
                 __init__.py
             urls.py
             admin.py
             views.py
             __init__.py

我的型号/abc.py:

class Abc(AbstractBaseUser):
MALE = "M"
FEMALE = "F"
SEX_CHOICES = [
    (MALE, "Male"),
    (FEMALE, "Female"),
]
SEX_CHOICES_AND_BLANK = [('', 'Select Gender')] + SEX_CHOICES

email = models.EmailField(_('Email Address'), max_length=70, unique=True)
first_name = models.CharField(_('First Name'), max_length=30)
last_name = models.CharField(_('Last Name'), max_length=30)
username = models.CharField(_('username'), max_length=70, unique=True)
gender = models.CharField(_("Gender"), max_length=1, choices=SEX_CHOICES, blank=True)
contact_number = models.CharField(
    _("Contact Number"),
    max_length=15,
    blank=True,
    validators=[
        RegexValidator(r'^s*(?:+?(d{1,3}))?[-. (]*(d{3})[-. )]*(d{3})[-. ]*(d{4})(?: *x(d+))?s*$')
    ])
# Profile extras
image = ImageFileField(upload_to=get_upload_file_name, blank=True, default='user-default.png')
about = models.TextField(_("about me"), blank=True)

提前感谢

您是否已在models的init.py中导入所有模型?需要导入models的init.py中的所有模型,如本答案所示。。如果不导入,django扩展将无法获取所有模型。

相关内容

最新更新