请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

AUTH_USER_MODEL refers to model 'users.UserProfile' that has not been installed

Bobby老师,之前我这个工程是跑成功的,但是最近不知道为什么启动之后会报错:
C:\envs\py37\Scripts\python.exe C:/workspace/shopDjangoProject/manage.py runserver 127.0.0.1:8001
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File “c:\Python37\lib\threading.py”, line 926, in _bootstrap_inner
self.run()
File “c:\Python37\lib\threading.py”, line 870, in run
self._target(*self._args, **self._kwargs)
File “C:\envs\py37\lib\site-packages\django\utils\autoreload.py”, line 54, in wrapper
fn(*args, **kwargs)
File “C:\envs\py37\lib\site-packages\django\core\management\commands\runserver.py”, line 109, in inner_run
autoreload.raise_last_exception()
File “C:\envs\py37\lib\site-packages\django\utils\autoreload.py”, line 77, in raise_last_exception
raise exception0.with_traceback(exception[2])
File “C:\envs\py37\lib\site-packages\django\utils\autoreload.py”, line 54, in wrapper
fn(*args, **kwargs)
File "C:\envs\py37\lib\site-packages\django_init
.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “C:\envs\py37\lib\site-packages\django\apps\registry.py”, line 91, in populate
app_config = AppConfig.create(entry)
File “C:\envs\py37\lib\site-packages\django\apps\config.py”, line 90, in create
module = import_module(entry)
File "c:\Python37\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “

Traceback (most recent call last):
File “C:\envs\py37\lib\site-packages\django\apps\registry.py”, line 155, in get_app_config
return self.app_configs[app_label]
KeyError: ‘users’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\envs\py37\lib\site-packages\django\contrib\auth_init_.py”, line 165, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL, require_ready=False)
File “C:\envs\py37\lib\site-packages\django\apps\registry.py”, line 205, in get_model
app_config = self.get_app_config(app_label)
File “C:\envs\py37\lib\site-packages\django\apps\registry.py”, line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label ‘users’.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:/workspace/shopDjangoProject/manage.py”, line 20, in
main()
File “C:/workspace/shopDjangoProject/manage.py”, line 16, in main
execute_from_command_line(sys.argv)
File “C:\envs\py37\lib\site-packages\django\core\management_init_.py”, line 381, in execute_from_command_line
utility.execute()
File “C:\envs\py37\lib\site-packages\django\core\management_init_.py”, line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “C:\envs\py37\lib\site-packages\django\core\management\base.py”, line 323, in run_from_argv
self.execute(*args, **cmd_options)
File “C:\envs\py37\lib\site-packages\django\core\management\commands\runserver.py”, line 60, in execute
super().execute(*args, **options)
File “C:\envs\py37\lib\site-packages\django\core\management\base.py”, line 364, in execute
output = self.handle(*args, **options)
File “C:\envs\py37\lib\site-packages\django\core\management\commands\runserver.py”, line 95, in handle
self.run(**options)
File “C:\envs\py37\lib\site-packages\django\core\management\commands\runserver.py”, line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File “C:\envs\py37\lib\site-packages\django\utils\autoreload.py”, line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File “C:\envs\py37\lib\site-packages\django\utils\autoreload.py”, line 564, in start_django
reloader.run(django_main_thread)
File “C:\envs\py37\lib\site-packages\django\utils\autoreload.py”, line 272, in run
get_resolver().urlconf_module
File “C:\envs\py37\lib\site-packages\django\utils\functional.py”, line 80, in get
res = instance.dict[self.name] = self.func(instance)
File “C:\envs\py37\lib\site-packages\django\urls\resolvers.py”, line 564, in urlconf_module
return import_module(self.urlconf_name)
File “c:\Python37\lib\importlib_init_.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “

Process finished with exit code 1
图片描述

图片描述

图片描述

正在回答 回答被采纳积分+3

1回答

提问者 慕姐7020064 2023-11-28 20:29:48

解决了,把python环境重新搞了一遍,然后执行命令 python manage.py migrate , python manage.py  makemigrations 解决了这个问题,代码没有修改,但是不知道为什么?

0 回复 有任何疑惑可以回复我~
  • bobby #1
    好的。。。一般遇到这种问题重新新建一个django项目 然后把之前的代码拷贝进去就可以了
    回复 有任何疑惑可以回复我~ 2023-11-30 17:33:54
  • 提问者 慕姐7020064 回复 bobby #2
    谢谢老师
    回复 有任何疑惑可以回复我~ 2023-12-09 16:54:14
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号