作者:L鸿玖 | 来源:互联网 | 2023-08-25 13:33
AfterIinstalleddjango-registration,thinghappened.Iputappnamedregistrationundertheinst
After I installed django-registration, thing happened. I put app named "registration" under the installed-apps. And it is now giving me. I tried to solve this issue but dont't have any idea how to tackle it. In the Stackoverflow, I found similar problems and solutions for this. But I cannot add command like "import django" and "django.setup()" to registry.py file. I've done also work like changing wsgi.py file
安装django-registration后,事情发生了。我把名为“registration”的应用程序放在installed-apps下。它现在给了我。我试图解决这个问题,但不知道如何解决它。在Stackoverflow中,我发现了类似的问题和解决方案。但是我无法在registry.py文件中添加“import django”和“django.setup()”之类的命令。我也做过改变wsgi.py文件的工作
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration/models.py", line 15, in
User = get_user_model()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 136, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/registry.py", line 199, in get_model
self.check_models_ready()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/registry.py", line 131, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
This is my wsgi.py file.
这是我的wsgi.py文件。
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "realpro.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
I appreciate any feedback for this problem for me and everyone who starts to install "django-registration" program.
对于我和每个开始安装“django-registration”计划的人,我感谢您对此问题的任何反馈。
1 个解决方案