i’m not sure I understand the question
When you click on the run button, it’s going to cause some command to be issued. What is that command?
the following is exactly what happens in full after i run my models file:
[]
Traceback (most recent call last):
File "C:\Users\ftefo\PycharmProjects\pythonProject1\myproject\myapp\models.py", line 11, in <module>
class MotorData(models.Model):
File "C:\Users\ftefo\PycharmProjects\pythonProject1\.venv\lib\site-packages\django\db\models\base.py", line 129, in __new__
app_config = apps.get_containing_app_config(module)
File "C:\Users\ftefo\PycharmProjects\pythonProject1\.venv\lib\site-packages\django\apps\registry.py", line 260, in get_containing_app_config
self.check_apps_ready()
File "C:\Users\ftefo\PycharmProjects\pythonProject1\.venv\lib\site-packages\django\apps\registry.py", line 138, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Process finished with exit code 1```
Does the Django tutorial show you to run a models.py file?
How does the tutorial tell you to run your project?
Hii Sir
getting thise error when Im trying to Makemigrations
File "/home/hemant/energybot-wa/energybot-wa/iot/urls.py", line 7, in <module>
from api import quotation, proposals
File "/home/hemant/energybot-wa/energybot-wa/api/quotation.py", line 18, in <module>
from iot_app.models import *
File "/home/hemant/energybot-wa/energybot-wa/iot_app/models.py", line 3, in <module>
from django.contrib.auth.models import AbstractUser
File "/home/hemant/waenv/venv/lib/python3.8/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/hemant/waenv/venv/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/home/hemant/waenv/venv/lib/python3.8/site-packages/django/db/models/base.py", line 103, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/hemant/waenv/venv/lib/python3.8/site-packages/django/apps/registry.py", line 252, in get_containing_app_config
self.check_apps_ready()
File "/home/hemant/waenv/venv/lib/python3.8/site-packages/django/apps/registry.py", line 135, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
Welcome @ShelkeKi !
Please open a new topic for your issue. When doing so, please include the complete traceback, starting from the command being issued.
Three things to check:
- Your current directory in the shell is the base directory of your project.
- Your virtual environment for your project is active.
- Are you trying to perform any ORM or database operations at the module level in any of your project files?
Also, please post your INSTALLED_APPS
setting.
When you’re posting code, templates, or error messages, you need to use the backtick - ` character, not the apostrophe - ', and the three backticks need to be lines by themselves - not part of any other line.
Application definition
INSTALLED_APPS = [
‘channels’,
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘rest_framework’,
‘django_crontab’,
‘iot_app’,
‘webpush’,
‘api’,
‘silk’,
]
thise is my install app code in setting there are five file for example local_dev.py, base.py , dev.py etc. thise code write in base.py
As I mentioned above:
This is in addition to checking those three things listed.
Hiii Sir
- Your current directory in the shell is the base directory of your project. —> yes its base directory
- Your virtual environment for your project is active.----> i have activated virtual environment
3 . 1. Are you trying to perform any ORM or database operations at the module level in any of your project files? —> No
I have add ‘state’ field in System models For That Im Trying To Do Makemigartion
and Its Rise the error that…
‘’‘python manage.py makemigrations --setting=iot.settings.local_dev
Traceback (most recent call last):
File “manage.py”, line 21, in
main()
File “manage.py”, line 17, in main
execute_from_command_line(sys.argv)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/management/init.py”, line 381, in execute_from_command_line
utility.execute()
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/management/init.py”, line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 323, in run_from_argv
self.execute(*args, **cmd_options)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 361, in execute
self.check()
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 387, in check
all_issues = self._run_checks(
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 377, in _run_checks
return checks.run_checks(**kwargs)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/checks/registry.py”, line 72, in run_checks
new_errors = check(app_configs=app_configs)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/checks/urls.py”, line 13, in check_url_config
return check_resolver(resolver)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/core/checks/urls.py”, line 23, in check_resolver
return check_method()
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/urls/resolvers.py”, line 399, in check
for pattern in self.url_patterns:
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/utils/functional.py”, line 80, in get
res = instance.dict[self.name] = self.func(instance)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/urls/resolvers.py”, line 584, in url_patterns
patterns = getattr(self.urlconf_module, “urlpatterns”, self.urlconf_module)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/utils/functional.py”, line 80, in get
res = instance.dict[self.name] = self.func(instance)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/urls/resolvers.py”, line 577, in urlconf_module
return import_module(self.urlconf_name)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 848, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/home/hemant/energybot-wa/energybot-wa/iot/urls.py”, line 7, in
from api import quotation, proposals
File “/home/hemant/energybot-wa/energybot-wa/api/quotation.py”, line 18, in
from iot_app.models import *
File “/home/hemant/energybot-wa/energybot-wa/iot_app/models.py”, line 3, in
from django.contrib.auth.models import AbstractUser
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/contrib/auth/models.py”, line 2, in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/contrib/auth/base_user.py”, line 47, in
class AbstractBaseUser(models.Model):
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/db/models/base.py”, line 103, in new
app_config = apps.get_containing_app_config(module)
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/apps/registry.py”, line 252, in get_containing_app_config
self.check_apps_ready()
File “/home/hemant/waenv/venv/lib/python3.8/site-packages/django/apps/registry.py”, line 135, in check_apps_ready
raise AppRegistryNotReady(“Apps aren’t loaded yet.”)
django.core.exceptions.AppRegistryNotReady: Apps aren’t loaded yet.
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit’‘’
hello sir I have a problem when I apply docker in my project.
Welcome @kid1356 !
See my reply above at Python Shell Apps aren't loaded yet - #26 by KenWhitesell
Hi! Can you, please, help me with the same problem?
I am deploying my first django project to Digital Ocean Server.
I have the same error. The problem is with django.core app
. But it is not in INSTALLED_APPS
.
I am sure that this app is the reason because I have added a row print(self)
to the function check_apps_ready()
before raise AppRegistryNotReady("Apps aren't loaded yet.")
Well I do not know how to fix this problem to avoid check of this app django.core
.
Thank you!
Welcome @chornenkj !
Please open a new topic for your issue. When doing so, please include the complete traceback, starting from the command being issued.
Three things to check:
- Your current directory in the shell is the base directory of your project.
- Your virtual environment for your project is active.
- Are you trying to perform any ORM or database operations at the module level in any of your project files?
Also, please post your INSTALLED_APPS
setting.
When you’re posting code, templates, or error messages, you need to use the backtick - ` character, not the apostrophe - ', and the three backticks need to be lines by themselves - not part of any other line.
Hi, thanks for answer!
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.forms',
# My apps
'home.apps.HomeConfig',
'experts.apps.ExpertsConfig',
'clients.apps.ClientsConfig',
'blog.apps.BlogConfig',
'chat.apps.ChatConfig',
'link.apps.LinkConfig',
'search.apps.SearchConfig',
'management.apps.ManagementConfig',
'events.apps.EventsConfig',
'marketing.apps.MarketingConfig',
# Django-allauth
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
# Crispy forms
'crispy_forms',
'crispy_bootstrap5',
# Date picker
'bootstrap_datepicker_plus',
# Django-embed-video
'embed_video',
]
Things to check:
- Directory - y, sure - its the directory of my project with
manage.py
file. First, I used commandpython3 manage.py makemigrations
, and I got the same error, then I usedpython3 manage.py check
. And got traceback:
(venv) django@ubuntu-s-1vcpu-512mb-10gb-ams3-01:~/likarnet$ python3 manage.py check
django.core
Traceback (most recent call last):
File "/home/django/likarnet/manage.py", line 22, in <module>
main()
File "/home/django/likarnet/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/django/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 447, in execute_from_command_line
utility.execute()
File "/home/django/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 441, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/django/venv/lib/python3.12/site-packages/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/django/venv/lib/python3.12/site-packages/django/core/management/base.py", line 448, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/django/venv/lib/python3.12/site-packages/django/core/management/commands/check.py", line 76, in handle
self.check(
File "/home/django/venv/lib/python3.12/site-packages/django/core/management/base.py", line 475, in check
all_issues = checks.run_checks(
^^^^^^^^^^^^^^^^^^
File "/home/django/venv/lib/python3.12/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/django/venv/lib/python3.12/site-packages/django/core/checks/translation.py", line 62, in check_language_settings_consistent
get_supported_language_variant(settings.LANGUAGE_CODE)
File "/home/django/venv/lib/python3.12/site-packages/django/utils/translation/__init__.py", line 255, in get_supported_language_variant
return _trans.get_supported_language_variant(lang_code, strict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/django/venv/lib/python3.12/site-packages/django/utils/translation/trans_real.py", line 519, in get_supported_language_variant
if code.lower() in supported_lang_codes and check_for_language(code):
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/django/venv/lib/python3.12/site-packages/django/utils/translation/trans_real.py", line 478, in check_for_language
for path in all_locale_paths()
^^^^^^^^^^^^^^^^^^
File "/home/django/venv/lib/python3.12/site-packages/django/utils/translation/trans_real.py", line 455, in all_locale_paths
for app_config in apps.get_app_configs():
^^^^^^^^^^^^^^^^^^^^^^
File "/home/django/venv/lib/python3.12/site-packages/django/apps/registry.py", line 148, in get_app_configs
self.check_apps_ready()
File "/home/django/venv/lib/python3.12/site-packages/django/apps/registry.py", line 138, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
- Y, sure, python version - 3.12.3, django version - 4.1.13
- No, I have browsed to check settings, urls, wsgi and all models.py files from all my apps
P.S. I have also seen the rows in traceback dedicated to translations, but I am not abknowledged how they work totally, so I tried to set LANGUAGE_CODE
to en-US
, and USE_I18N
and USE_L10N
to False
, but that did not work.
Thanks a lot!
You need to check all files. If you’re trying to perform any database operation at the module level, it can cause this error. Make sure you’re not trying to perform any queries outside of a function.
I have checked all files and I do not see queries outside functions.
Can you, please, explain, should I take into account the following actions? Thanks!
Actually those actions are not database queries.
-
admin.site.register()
function fromadmin.py
files -
creating logger
logger = logging.getLogger(__name__)
inviews.py
modules -
creating choices tuples which are used in model class
BLOCK_TYPE_CHOICES = (
('text', "Текстовий блок"),
('olist', "Пронумерований список"),
)
or like
TIMEZONE_CHOICES = tuple([(tz, tz) for tz in pytz.common_timezones])
No, none of those items would cause it.
Also, it’s not only queries - any ORM operation would cause it. And there may be other things as well. (I focus on the queries, because that’s where I see this happening most frequently.)
From the original traceback at the top, I’d want to see the iot/urls.py
, api/quotation.py
, and iot_app/models.py
files to continue trying to diagnose this.
Hi, sir. Those modules are not from my traceback
You’re right - I got lost in the thread.
About the best advice I can offer at this point is to start backing things out. Remove your apps one-by-one from your configuration until you get down to something that works.
Already done((((
I have tried to delete all of them.
The same error and the same traceback.
I have even added a row to the function raising error to print an app name… but its django.core…