第三课数据库的配置出现了错误!!

社长,我按你的教程写好了setting和model,可每次运行的时候都会报错,不知道什么原因,希望社长能帮我解答。错误如下:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000002E7A80737B8>
Traceback (most recent call last):
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\core\management\commands\runserver.py", line 112, in inner_run
autoreload.raise_last_exception()
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\utils\autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\core\management\__init__.py", line 327, in execute
autoreload.check_errors(django.setup)()
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\IU\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\contrib\auth\models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\contrib\auth\base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\db\models\base.py", line 114, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\db\models\base.py", line 315, in add_to_class
value.contribute_to_class(cls, name)
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\db\models\options.py", line 205, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\db\__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\db\utils.py", line 202, in __getitem__
backend = load_backend(db['ENGINE'])
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\db\utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Users\IU\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "D:\untitled2\lib\site-packages\django-2.0.8-py3.7.egg\django\db\backends\postgresql\base.py", line 20, in <module>
import psycopg2 as Database
File "D:\untitled2\lib\site-packages\psycopg2-2.6.2-py3.7-win-amd64.egg\psycopg2\__init__.py", line 104
connection_factory=None, cursor_factory=None, async=False, **kwargs):
^
SyntaxError: invalid syntax

涨见识0 涨水分0

** 文章讲述的内容可能你不赞同,不喜欢,但如果觉得观点新颖,内容独到,提高了你的知识面,帮你了解了你不懂的知识和知道了突发的新闻,这样的贴,希望能点涨见识,相反,到处转载,内容无聊,雷同,毫无建树,请点涨水分!

我要评论

提交评论
每个人都有自己的看法,登录以后马上发表。还没有账号?点击这里马上注册一个账号。

当前有1条评论

  • 繁花社长 :2018八月31号 22:10:00
    看你这贴出来的报错,感觉像psycopg2链接你数据库有问题
    是你配置没写好吧
    比如你数据库的用户名,密码什么的
    0 0 回复 举报

需要登录以后才能进行刚才的操作

  • 刚才的操作,需要登录以后才能继续,如果已经有账号,请点击登录,登录以后,会自动返回到当前页面进行刚才的操作。如果还没有账号,请点击注册。