環境:sql
Django==1.9.13 psycopg2==2.7.5 Python 3.6.5 postgresql 1.18.1
配置django的時候出現問題django
檢查setting,問題點:因爲安裝好的postgresql中的用戶postgres沒有默認密碼,因此鏈接不成功post
解決方案:從新配置用戶測試
在window 命令提示符下:postgresql
c:\>psql -h localhost -U postgres //使用postgres用戶無密碼登陸
postgres=# ALTER USER postgres WITH PASSWORD 'postgres'; //修改用戶postgres密碼爲「postgres」
postgres=# \q //退出psql模式
再次測試鏈接:code
鏈接成功,並建立表成功blog