Django 1.9:django.core.exceptions.AppRegistryNotReady:应用程序尚未加载

2023-12-27

我正在尝试使用这个应用程序https://github.com/benliles/django-chance https://github.com/benliles/django-chance在我的应用程序中。我的 Django 版本是 1.9。我收到以下错误:

python manage.py runserver
Unhandled exception in thread started by <function wrapper at 0x7f4931ce85f0>
Traceback (most recent call last):
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
    six.reraise(*_exception)
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/bewithaman/Projects/Event-Management-System/chance/__init__.py", line 1, in <module>
    from chance import signals
  File "/home/bewithaman/Projects/Event-Management-System/chance/signals.py", line 7, in <module>
    from chance.models import Registration
  File "/home/bewithaman/Projects/Event-Management-System/chance/models.py", line 2, in <module>
    from django.contrib.auth.models import User
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 49, in <module>
    class AbstractBaseUser(models.Model):
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

网站的文件树:-

├── chance
│   ├── admin.py
│   ├── admin.pyc
│   ├── forms.py
│   ├── forms.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   ├── 0002_add_eventchoice_allow_multiple.py
│   │   ├── 0002_add_eventchoice_allow_multiple.pyc
│   │   ├── 0003_add_created_and_label.py
│   │   ├── 0004_add_registration_owner.py
│   │   ├── __init__.py
│   │   └── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── signals.py
│   ├── signals.pyc
│   ├── templates
│   │   └── chance
│   │       ├── event_detail.html
│   │       ├── event_list.html
│   │       ├── registration_email_manager_subject.txt
│   │       ├── registration_email_subject.txt
│   │       ├── registration_email.txt
│   │       └── registration_form.html
│   ├── urls.py
│   ├── urls.pyc
│   ├── views.py
│   └── views.pyc
├── EMS
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── settings.py
│   ├── settings.pyc
│   ├── urls.py
│   ├── urls.pyc
│   ├── wsgi.py
│   └── wsgi.pyc
├── manage.py
├── media
│   └── profile_images
│       ├── 20140810_175920.jpg
│       ├── IMG-20150215-WA0013.jpg
│       ├── IMG-20150215-WA0015.jpg
│       ├── IMG-20150215-WA0018-1.jpg
│       ├── IMG-20150304-WA0005.jpg
│       └── Shubham_20140216_234708-1.jpg
├── notifications
│   ├── admin.py
│   ├── admin.pyc
│   ├── apps.py
│   ├── apps.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   ├── 0001_initial.pyc
│   │   ├── __init__.py
│   │   └── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── signals.py
│   ├── signals.pyc
│   ├── static
│   │   └── notifications
│   │       └── notify.js
│   ├── templates
│   │   └── notifications
│   │       ├── list.html
│   │       ├── notice.html
│   │       └── test_tags.html
│   ├── templatetags
│   │   ├── __init__.py
│   │   ├── __init__.pyc
│   │   ├── notifications_tags.py
│   │   └── notifications_tags.pyc
│   ├── tests
│   │   ├── __init__.py
│   │   ├── settings.py
│   │   ├── static
│   │   │   └── notifications
│   │   │       └── live-test.js
│   │   ├── templates
│   │   │   └── test_live.html
│   │   ├── tests.py
│   │   ├── urls.py
│   │   └── views.py
│   ├── urls.py
│   ├── urls.pyc
│   ├── utils.py
│   ├── utils.pyc
│   ├── views.py
│   └── views.pyc
├── registeration
│   ├── admin.py
│   ├── admin.pyc
│   ├── forms.py
│   ├── forms.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   ├── 0001_initial.pyc
│   │   ├── 0002_auto_20160211_1250.py
│   │   ├── 0002_auto_20160211_1250.pyc
│   │   ├── 0003_event_participants.py
│   │   ├── 0003_event_participants.pyc
│   │   ├── __init__.py
│   │   └── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── tests.py
│   ├── urls.py
│   ├── urls.pyc
│   ├── views.py
│   └── views.pyc
├── static
│   ├── css
│   │   ├── bootstrap.css
│   │   ├── bootstrap-fluid-adj.css
│   │   ├── bootstrap.min.css
│   │   ├── bootstrap-responsive.css
│   │   └── bootstrap-responsive.min.css
│   ├── img
│   │   ├── glyphicons-halflings.png
│   │   ├── glyphicons-halflings-white.png
│   │   └── twd.ico
│   └── js
│       ├── bootstrap.js
│       ├── bootstrap.min.js
│       ├── jquery-2.0.3.js
│       ├── jquery-2.0.3.min.js
│       └── rango-ajax.js
└── templates
    └── registeration
        ├── base.html
        ├── events.html
        ├── index.html
        ├── login.html
        ├── profile.html
        └── register.html

我已遵循所有说明,但我无法找出问题所在。请帮我。


The Django 机会 https://github.com/benliles/django-chance您使用的应用程序已经好几年没有更新了,并且似乎不支持 Django 1.9。您可以使用不同的应用程序,或者尝试更新它以使用 Django 1.9。

这部分回溯显示它导入了signals.py in the __init__.py,它尝试在加载应用程序之前导入模型。

  File "/home/bewithaman/Projects/Event-Management-System/chance/__init__.py", line 1, in <module>
    from chance import signals
  File "/home/bewithaman/Projects/Event-Management-System/chance/signals.py", line 7, in <module>
    from chance.models import Registration

从您的chance/__init__.py file

from chance import signals

然后创建一个change/apps.py文件,并定义一个应用程序配置类,用于导入信号ready() method.

from django.apps import AppConfig

class ChanceConfig(AppConfig):

    def ready(self):
        from . import signals

最后,更新您的INSTALLED_APPS设置使用您的配置。

INSTALLED_APPS = [
    ...
    'chance.apps.ChanceConfig',
    ...
]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Django 1.9:django.core.exceptions.AppRegistryNotReady:应用程序尚未加载 的相关文章

随机推荐

  • 两种产品之间的差异最接近于零:非暴力解决方案?

    In a 挪威科学博物馆 https nordnorsk vitensenter no 我遇到了以下数学游戏 目标是放置从 0 到 9 的 10 位数字 使两种产品之间的差异最接近于零 246是目前最低分 回到家我写了以下暴力代码 impo
  • 在运行时调整 MTD 分区大小

    我正在使用嵌入式设备 并希望它们能够通过 Linux 调整 MTD 分区的大小 而无需重新启动 问题是我的 Linux 映像大小已增加 并且它所在的当前 MTD 分区 mtd0 现在太小了 但是 紧随其后的分区 mtd1 是用于存储配置信息
  • Odoo 11 在同一模型的两个不同区域添加不同的操作菜单

    在 Odoo 11 中 我想要两个具有两种不同功能的不同操作菜单 在人力资源工资单中 我想添加电子邮件工资单链接 这就是为什么我使用此代码添加电子邮件工资单操作菜单
  • solve_ivp 错误:“缺少 2 个必需的位置参数:”

    我用于solve ivp的函数定义为 def ydot t y kappa4 kappa16 使用solve ivp时如下 sol solve ivp ydot 0 10 initial condition args 50 100 我收到以
  • 如何使用 Django FileFields 在模板中显示当前文件

    我有点卡住了 我已经使用 Django 一段时间了 但我实际上似乎无法找到这个东西 这很奇怪 因为它应该是一件简单的事情 我一直在谷歌上搜索 似乎找不到解决方案 这可能是因为它很简单 问题是 我有一个 ModelForm 它有一个 File
  • Excel 工作簿的 R Download.File 问题

    我正在尝试使用 R 下载 Excel 工作簿下载文件 http stat ethz ch R manual R patched library utils html download file html功能 当我手动下载文件 使用 Inte
  • POI中如何判断文件是doc还是docx

    标题可能有点令人困惑 最简单的方法必须是通过扩展名来判断 如下所示 is represents the InputStream if filePath endsWith doc WordExtractor ex new WordExtrac
  • 显示:内联表

    IE 7 不支持display inline table 其他浏览器支持 对于替代解决方案我应该做什么 火狐和 IE8 支持display inline table IE6支持display inline table class inlin
  • 从 data.frame 到 ggplot2 图例的表达式

    我想向图例条目添加一个表达式 而不直接输入图例 因为我正在循环变量 本质上我想要这样 d lt data frame x 1 10 y 1 10 f rep c 0 74 gt 75 each 5 qplot x y data d colo
  • LoopBack:如何在代码中动态创建自定义 REST 端点(即时)

    我们使用 LoopBack REST 框架来公开我们的数据库 和业务逻辑 我们需要允许客户在数据库 单租户和多租户 中创建自定义表 这些表可以通过 REST 端点进行访问 所有客户都需要使用相同的通用 生产 REST 端点 这些端点将公开在
  • Flutter 是否支持 FieldPath?

    我找不到FieldPath in the cloud firestore颤振插件 https pub dartlang org packages cloud firestore但是 我认为这是一个非常常见的工具 将是此类插件的第一个实现之一
  • NativeScript WebView在默认浏览器中打开url

    我正在尝试构建应用程序WebView以及 WebView 内 URL 上的单击 点击事件 下面的解决方案打开外部浏览器和 URL 但它也在 webview 中加载相同的 url 内容 有没有办法阻止在 webview 中加载新的 url 这
  • 运行“npm install”时保留符号链接

    如果我们这样做 npm link x 然后我们跑npm install 它将覆盖符号链接包 有没有办法跑npm install不覆盖符号链接包 就像是 npm install preserve symlinks or npm install
  • 如何防止单击锚元素内的图像时的链接行为?

    我有一个与此类似的代码 a href link html goto link page img src images edit gif alt a 现在 如果您单击文本 我希望 href 链接能够正常工作 但是如果您单击图像 它应该执行其他
  • 在 Safari 中跳转输入字段

    我正在尝试重新创建一个非常酷的占位符用户界面 http dribbble com shots 1254439 GIF Mobile Form Interaction list users只使用 HTML 和 CSS 我就差不多明白了 dem
  • Vulkan 的 VkMemoryHeapFlagBits 是否缺少值?

    在 Vulkan 规范 1 0 9 第 180 页 中 我们有以下内容 typedef struct VkMemoryHeap VkDeviceSize size VkMemoryHeapFlags flags VkMemoryHeap 和
  • C# - 值类型的引用包装器

    我想用c Pointtype 作为引用类型 它是一个结构 我想到了上课CPoint 其中将包含一个Point成员 有什么办法可以提高会员人数吗 Point担任成员Cpoint 我正在努力避免 cpoint point X cpoint po
  • SQL Server 从表中读取 csv 二进制文件

    我目前将 csv 格式的文件存储在磁盘上 然后像这样查询它们 SELECT FROM OPENROWSET BULK C myfile csv FORMATFILE C format fmt FIRSTROW 2 AS rs 其中 form
  • javascript 中计数器变量的奇怪值[重复]

    这个问题在这里已经有答案了 可能的重复 Javascript 臭名昭著的循环问题 https stackoverflow com questions 1451009 javascript infamous loop problem 由于某种
  • Django 1.9:django.core.exceptions.AppRegistryNotReady:应用程序尚未加载

    我正在尝试使用这个应用程序https github com benliles django chance https github com benliles django chance在我的应用程序中 我的 Django 版本是 1 9 我