我的代码在另一台机器上运行并且它运行正常,因为我使用github进行版本控制,所以代码完全相同,但是当我在我的机器上运行时,我开始出现这个错误,我使用了postgres,我已经尝试过删除数据库并创建另一个但继续此错误。 从运行正常的计算机导入数据库后,错误开始。 当我试图回到本地数据库时,我开始出错,我已经尝试重新安装所有软件包(通过pip安装的软件包),什么也没有。
我正在使用Django 1.10
Unhandled exception in thread started by <_pydev_bundle.pydev_monkey._NewThreadStartupWithTrace instance at 0x7f7aa3e35ef0>
Traceback (most recent call last):
File "/home/marco/documentos/pycharm/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 589, in __call__
return self.original_func(*self.args, **self.kwargs)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run
self.check(display_num_errors=True)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/core/management/base.py", line 385, in check
include_deployment_checks=include_deployment_checks,
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/core/management/base.py", line 372, in _run_checks
return checks.run_checks(**kwargs)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/core/checks/urls.py", line 24, in check_resolver
for pattern in resolver.url_patterns:
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/urls/resolvers.py", line 310, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/urls/resolvers.py", line 303, in urlconf_module
return import_module(self.urlconf_name)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/importlib /__init__.py", line 37, in import_module
__import__(name)
File "/home/marco/miniconda2/envs/venv/lib/python2.7/site-packages/django/forms/models.py", line 252, in __new__
raise FieldError(message) django.core.exceptions.FieldError: Unknown field(s) (country, name, instituicao) specified for User
答案 0 :(得分:1)
"AUTH_USER_MODEL = 'accounts.User'
行,而另一台机器的设置与我的位置不同,它有效!