Postgresql / Django 问题。密码无效/数据库未被访问?
接收这个在 Win7 上运行的 Django。朋友设置了 django &数据库并表示 settings.py 中的所有信息都是正确的,但当我尝试在本地测试时,我不断收到此错误。另一个奇怪的事情是,当我从项目目录中完全删除 .sql 文件时,我仍然收到相同的错误。
File "c:\python26\lib\site-packages\django\db\backends\postgresql_psycopg2\base.py", line 98, in _cursor
self.connection = Database.connect(**conn_params)
OperationalError: FATAL: password authentication failed for user "post_user"
Settings.py:
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'pinax'
DATABASE_USER = 'post_user'
DATABASE_PASSWORD = 'pass'
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''
想法?
Receiving this running Django on Win7. Friend set up django & database and says all the information in the settings.py is correct but I keep receiving this error when I try to test locally. The other weird thing is when I remove the .sql file from the project directory completely I still receive the same error.
File "c:\python26\lib\site-packages\django\db\backends\postgresql_psycopg2\base.py", line 98, in _cursor
self.connection = Database.connect(**conn_params)
OperationalError: FATAL: password authentication failed for user "post_user"
Settings.py:
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'pinax'
DATABASE_USER = 'post_user'
DATABASE_PASSWORD = 'pass'
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''
Thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 OSX 上也遇到了同样的问题。我使用 pgAdminIII 创建我的数据库用户,它帮助我填写了“帐户过期”字段......到 1969 年。将其设置为未来的日期解决了问题。
在控制台中,您还可以使用 sql 命令,例如:
I had the same problem on OSX. I used pgAdminIII to create my database user and it helpfully filled in the "Account expires" field for me... to 1969. Setting this to a future date fixed the problem.
In console you can also use a sql command like:
将“主机”信息留空(空白默认为 localhost),并首先仔细检查数据库连接(工具 -> 数据源,右键单击您的数据库,单击“数据源属性”,然后在窗口底部弹出点击“测试连接”)。您可能必须手动更改驱动程序(不太可能)或指定语言(也不太可能),这些都可以在检查连接的窗口中完成。
leave the "Host" info blank (blank defaults to localhost), and also double check the database connection first (tools -> data sources, right click your database, click 'data source properties', and at the bottom of the window that pops up click 'test connection'). You may have to manually change the driver (unlikely) or specify the language (also unlikely), those can both be done in the window where you check the connection.