ubuntu中启动django服务,出现如下报错:LookupError: No installed app with label 'admin'.

来源:7-2 新建项目和apps

隽愉

2019-08-15

LookupError: No installed app with label ‘admin’.
请问一下出现这种情况如何解决

以下是所有的错误提示,之前有在Stack Overflow上寻找到方法,成功之后,又再次出现这种问题,不知道是因为什么;
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python3.7/threading.py”, line 917, in _bootstrap_inner
self.run()
File “/usr/lib/python3.7/threading.py”, line 865, in run
self._target(*self._args, **self._kwargs)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/utils/autoreload.py”, line 54, in wrapper
fn(*args, **kwargs)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/core/management/commands/runserver.py”, line 109, in inner_run
autoreload.raise_last_exception()
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/utils/autoreload.py”, line 77, in raise_last_exception
raise _exception0.with_traceback(_exception[2])
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/utils/autoreload.py”, line 54, in wrapper
fn(*args, **kwargs)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/init.py”, line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/apps/registry.py”, line 91, in populate
app_config = AppConfig.create(entry)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/apps/config.py”, line 160, in create
app_name, mod_path, cls_name,
django.core.exceptions.ImproperlyConfigured: Cannot import ‘courses’. Check that ‘apps.courses.apps.CoursesConfig.name’ is correct.

Traceback (most recent call last):
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/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 21, in
main()
File “manage.py”, line 17, in main
execute_from_command_line(sys.argv)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/core/management/init.py”, line 381, in execute_from_command_line
utility.execute()
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/core/management/init.py”, line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/core/management/base.py”, line 323, in run_from_argv
self.execute(*args, **cmd_options)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/core/management/commands/runserver.py”, line 60, in execute
super().execute(*args, **options)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/core/management/base.py”, line 364, in execute
output = self.handle(*args, **options)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/core/management/commands/runserver.py”, line 95, in handle
self.run(**options)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/core/management/commands/runserver.py”, line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/utils/autoreload.py”, line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/utils/autoreload.py”, line 564, in start_django
reloader.run(django_main_thread)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/utils/autoreload.py”, line 272, in run
get_resolver().urlconf_module
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/utils/functional.py”, line 80, in get
res = instance.dict[self.name] = self.func(instance)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/site-packages/django/urls/resolvers.py”, line 564, in urlconf_module
return import_module(self.urlconf_name)
File “/root/.local/share/virtualenvs/mxonline-Ap9c70xJ/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “

写回答

4回答

Elisha666

2020-08-30

其实只要在创建的应用里的apps.py里的name加上apps.就行了

//img1.sycdn.imooc.com/szimg/5f4bae7d09e36f9e04840185.jpg

//img.mukewang.com/szimg/5f4bae7d0989672912591035.jpg


1
0

毛毛毛子

2020-03-03

老师我也是出现了这个问题,请问怎么解决呢?在添加进新的apps 之前是没有bug的,但按着视频添加进courses,users,operations,organizations之后就出现了这个bug了。 把他们注释了之后就没问题。  这个是我的QQ:2353440665. 请老师帮忙看看,谢谢

0
2
bobby
回复
毛毛毛子
你有验证信息
2020-03-05
共2条回复

老白666666

2019-08-23

请问这个问题如何解决?我也遇到了

0
0

bobby

2019-08-16

//img.mukewang.com/szimg/5d562ece0933b1af16390391.jpg settings中把这一行写上试试

0
9
慕九州7078559
回复
bobby
老师我也遇到这个问题了我的qq是1114572041
2020-03-07
共9条回复

Django+ xadmin 开发在线教育网站

一套通用的技术组合拳,助你解决大部分Python类网站后端问题

1911 学习 · 2149 问题

查看课程