我有一个Django项目。一切正常,直到突然出现一些奇怪的错误,例如“ unknown arguments'pk'”。现在我无法运行管理员,出现此错误
get() got an unexpected keyword argument 'session_key'
我无法迁移,python无法理解我的models.py更改,当我运行makemigrations命令时,出现此错误:
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\migrate.py", line 227, in handle
self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan,
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\sql.py", line 53, in emit_post_migrate_signal
**kwargs
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\dispatch\dispatcher.py", line 193, in send
for receiver in self._live_receivers(sender)
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\dispatch\dispatcher.py", line 193, in <listcomp>
for receiver in self._live_receivers(sender)
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\auth\management\__init__.py", line 63, in create_permissions
ctype = ContentType.objects.db_manager(using).get_for_model(klass)
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\contenttypes\models.py", line 54, in get_for_model
ct = self.get(app_label=opts.app_label, model=opts.model_name)
File "C:\Users\kostas\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
TypeError: get() got an unexpected keyword argument 'app_label'
突然发生了什么? 有人可以帮我吗?
非常感谢
Kostas
答案 0 :(得分:0)
我重新安装了Python和Django,一切正常
非常感谢您的时间