已经按照视频中讲到的在settings中加上了AUTH_USER_MODEL = "users.UserProfile"
但还是在迁移数据库文件时报错 ,不知道是哪里的问题
Traceback (most recent call last):
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\apps\config.py”, line 178, in get_
model
return self.models[model_name.lower()]
KeyError: ‘userprofile’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\auth_init_.py”, line 16
5, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL, require_ready=False)
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\apps\registry.py”, line 210, in ge
t_model
return app_config.get_model(model_name, require_ready=require_ready)
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\apps\config.py”, line 181, in get_
model
"App ‘%s’ doesn’t have a ‘%s’ model." % (self.label, model_name))
LookupError: App ‘users’ doesn’t have a ‘UserProfile’ model.
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 “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management_init_.py”, line
381, in execute_from_command_line
utility.execute()
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management_init_.py”, line
357, in execute
django.setup()
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django_init_.py”, line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\apps\registry.py”, line 122, in po
pulate
app_config.ready()
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\apps.py”, line 24, i
n ready
self.module.autodiscover()
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin_init_.py”, line 2
6, in autodiscover
autodiscover_modules(‘admin’, register_to=site)
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\module_loading.py”, line 47,
in autodiscover_modules
import_module(’%s.%s’ % (app_config.name, module_to_search))
File “C:\Users\华硕\AppData\Local\Programs\Python\Python36\lib\importlib_init_.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “
userprofile表定义源码
2. 左侧代码导航结构
3. users下的apps.py源码
4. install_apps的配置