LookupError: No installed app with label "admin"
LookupError: No installed app with label "admin"
所以我正在尝试 运行 我的开发服务器使用命令 "python manage.py runserver"
但是每当我尝试 运行 它时,它都会给我这个错误;
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_countries'
Traceback (most recent call last):
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 155, in get_app_config
return self.app_configs[app_label]
KeyError: 'admin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "F:\Users\Kasutaja\Documents\Veebipood v4\django-ecommerce\djecommerce\urls.py",
line 6, in <module>
path('admin/', admin.site.urls),
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 256, in inner
self._setup()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\admin\sites.py", line 529, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
我已尝试寻找此问题的解决方案,但似乎没有任何效果。 django-countries 似乎也有一个奇怪的问题。每当我尝试安装它时,它都会显示;
Collecting django-countries
Using cached django-countries-6.0.tar.gz (617 kB)
WARNING: Generating metadata for package django-countries produced metadata for project name unknown. Fix your #egg=django-countries fragments.
Requirement already satisfied (use --upgrade to upgrade): unknown from https://files.pythonhosted.org/packages/6d/7a/4046a82f6f0c7d00ad24b3a4fc30d10c562949bb6cd40ef7f3051ed7e2bc/django-countries-6.0.tar.gz#sha256=cca351f304d18187b6200e1aae381c2902045c33aea5f4da58fd74685b7cd4fc in c:\users\kasutaja\appdata\local\programs\python\python36-32\lib\site-packages
The weird thing with this is, that whenever I try to run "python manage.py makemigrations", it says;
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_countries'
有谁知道如何解决这个问题?
提前致谢,
尼美图.
好的,明白了。只是把它放在那里以防万一有人遇到同样的问题。如果你的项目有一个 requirements.txt 文件(如果它没有)并添加(如果你想使用 django-countries)
django-countries==5.3.3
对它来说,你也可以使用最新版本,但我在这种情况下选择使用5.3.3版本。在那之后 运行 命令
pip install -r requirements.txt
所以我正在尝试 运行 我的开发服务器使用命令 "python manage.py runserver" 但是每当我尝试 运行 它时,它都会给我这个错误;
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_countries'
Traceback (most recent call last):
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 155, in get_app_config
return self.app_configs[app_label]
KeyError: 'admin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "F:\Users\Kasutaja\Documents\Veebipood v4\django-ecommerce\djecommerce\urls.py",
line 6, in <module>
path('admin/', admin.site.urls),
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 256, in inner
self._setup()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\admin\sites.py", line 529, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
我已尝试寻找此问题的解决方案,但似乎没有任何效果。 django-countries 似乎也有一个奇怪的问题。每当我尝试安装它时,它都会显示;
Collecting django-countries
Using cached django-countries-6.0.tar.gz (617 kB)
WARNING: Generating metadata for package django-countries produced metadata for project name unknown. Fix your #egg=django-countries fragments.
Requirement already satisfied (use --upgrade to upgrade): unknown from https://files.pythonhosted.org/packages/6d/7a/4046a82f6f0c7d00ad24b3a4fc30d10c562949bb6cd40ef7f3051ed7e2bc/django-countries-6.0.tar.gz#sha256=cca351f304d18187b6200e1aae381c2902045c33aea5f4da58fd74685b7cd4fc in c:\users\kasutaja\appdata\local\programs\python\python36-32\lib\site-packages
The weird thing with this is, that whenever I try to run "python manage.py makemigrations", it says;
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_countries'
有谁知道如何解决这个问题? 提前致谢, 尼美图.
好的,明白了。只是把它放在那里以防万一有人遇到同样的问题。如果你的项目有一个 requirements.txt 文件(如果它没有)并添加(如果你想使用 django-countries)
django-countries==5.3.3
对它来说,你也可以使用最新版本,但我在这种情况下选择使用5.3.3版本。在那之后 运行 命令
pip install -r requirements.txt