因此,我有一个名为Profile的扩展用户模型(扩展的AbstractUser)。这是在另一个名为“个人资料”的应用中。我插入了标准登录名,并意识到它正在寻找标准的“配置文件”应用程序名称,因此我将其重命名为(目录,代码,数据库模式),我认为该名称应能起作用。 app_name实际上已经在apps.py中设置为“配置文件”,因此不需要重命名url引用。
没有骰子。我得到标题中的错误。
因此,我删除了所有迁移(我现在仍然可以这样做:)),并删除了当前正在使用的sqlite DB,以为我只是重新运行迁移并重新创建所有内容。
相同错误。
堆栈跟踪为:
λ python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\django\core\management\base.py", line 361, in execute
self.check()
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\django\core\management\base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\django\core\management\base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\debug_toolbar\apps.py", line 18, in check_middleware
from debug_toolbar.middleware import DebugToolbarMiddleware
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\debug_toolbar\middleware.py", line 12, in <module>
from debug_toolbar.toolbar import DebugToolbar
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\debug_toolbar\toolbar.py", line 141, in <module>
urlpatterns = DebugToolbar.get_urls()
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\debug_toolbar\toolbar.py", line 134, in get_urls
for panel_class in cls.get_panel_classes():
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\debug_toolbar\toolbar.py", line 116, in get_panel_classes
import_string(panel_path) for panel_path in dt_settings.get_panels()
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\debug_toolbar\toolbar.py", line 116, in <listcomp>
import_string(panel_path) for panel_path in dt_settings.get_panels()
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\mjnic\.virtualenvs\pyp-E_0Se9Bl\lib\site-packages\debug_toolbar\panels\profiling.py", line 1, in <module>
import cProfile
File "D:\Python\Python37-32\Lib\cProfile.py", line 22, in <module>
run.__doc__ = _pyprofile.run.__doc__
AttributeError: module 'profile' has no attribute 'run'
作为重命名的一部分,我错过了什么?
我错过了其他任何有帮助的信息吗? (我已经搜索了“配置文件”的任何实例,但是现在所有内容都已正确重命名,并且此应用在此之前运行正常,因此纯粹是这个重命名弄乱了它)。
编辑:可能是“配置文件”与某些内部python例程冲突吗? python安装下的cProfile.py文件定义为
#! /usr/bin/env python3
"""Python interface for the 'lsprof' profiler.
Compatible with the 'profile' module.
"""
现在与我的项目无关吗?我是否仅需要将我的应用程序/扩展用户模型称为“个人资料”以外的其他名称?
答案 0 :(得分:1)
就我而言,它是 profile.py
文件。
删除文件并重试。
答案 1 :(得分:0)
好。是的,这是命名冲突。我已将“个人资料”模型和“个人资料”应用重命名为“ UserProfile”和“ user_profile”,并相应地更新了所有内容。现在一切似乎都可以工作了...
只需在此处回答,以防将来有人遇到同样的问题!