Pycharm给出了一个“错误”;类型错误:';非类型';对象不可调用";Python Django项目的调试模式
我已经在Pycharm中设置了Pycharm给出了一个“错误”;类型错误:';非类型';对象不可调用";Python Django项目的调试模式,python,django,pycharm,virtualenv,Python,Django,Pycharm,Virtualenv,我已经在Pycharm中设置了pythondjango项目 在运行模式下的python manage.py runserver命令上,它可以正常工作,但当我在调试模式下运行项目时,会出现以下异常: Traceback (most recent call last): File "/home/usmanmaqbool/Downloads/pycharm-community-2018.3/helpers/pydev/pydevd.py", line 2060, in <module>
pythondjango
项目
在运行模式下的python manage.py runserver
命令上,它可以正常工作,但当我在调试模式下运行项目时,会出现以下异常:
Traceback (most recent call last):
File "/home/usmanmaqbool/Downloads/pycharm-community-2018.3/helpers/pydev/pydevd.py", line 2060, in <module>
main()
File "/home/usmanmaqbool/Downloads/pycharm-community-2018.3/helpers/pydev/pydevd.py", line 2054, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/usmanmaqbool/Downloads/pycharm-community-2018.3/helpers/pydev/pydevd.py", line 1405, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "/home/usmanmaqbool/Downloads/pycharm-community-2018.3/helpers/pydev/pydevd.py", line 1412, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/usmanmaqbool/Desktop/proj/manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 58, in execute
super(Command, self).execute(*args, **options)
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 97, in handle
self.run(**options)
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 106, in run
autoreload.main(self.inner_run, None, options)
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 333, in main
reloader(wrapped_main_func, args, kwargs)
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 304, in python_reloader
exit_code = restart_with_reloader()
File "/home/usmanmaqbool/Envs/proj/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 290, in restart_with_reloader
exit_code = os.spawnve(os.P_WAIT, sys.executable, args, new_environ)
File "/home/usmanmaqbool/Downloads/pycharm-community-2018.3/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 496, in new_spawnve
return getattr(os, original_name)(mode, path, args, env)
File "/home/usmanmaqbool/Envs/proj/lib/python2.7/os.py", line 573, in spawnve
return _spawnvef(mode, file, args, env, execve)
File "/home/usmanmaqbool/Envs/proj/lib/python2.7/os.py", line 549, in _spawnvef
elif WIFSIGNALED(sts):
File "/home/usmanmaqbool/Envs/proj/lib/python2.7/os.py", line 549, in _spawnvef
elif WIFSIGNALED(sts):
TypeError: 'NoneType' object is not callable
Process finished with exit code 1
几天前,它还可以正常工作,但在Pycharm的新更新版本之后,我只在一个项目上遇到了这个问题。这是Pycharm 2019.2调试器对一些Python版本的回归,例如旧的2.7.x
修复程序已准备就绪,将包含在2019.2.1小更新中,预览版将于本周上线。2019.2.1版现已发布,并修复此错误 更新PyCharm的版本,如下所示: 转到
文件->设置->外观和行为->系统设置->更新
按
立即检查
然后按更新
你能在settings.py中共享你的数据库设置吗?@cagrias我已经更新了!能否更新“引擎”:“django.db.backends.postgresql”?自django 1.9以来,引擎名称更改为“引擎”:“django.db.backends.postgresql”。但显然这不是问题所在。在1.10文档中,您需要将其添加为“引擎”:“django.db.backends.postgresql”
。
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'db_name',
'USER': 'user',
'PASSWORD': 'passworf',
'HOST': 'localhost',
'PORT': '',
}
}