简体   繁体   English

PostgreSQL应用程序开发的postgres.app入门

[英]Getting started with postgres.app for Django application development

I'm a newbie trying to get started with postgres.app . 我是一个新手,试图开始使用postgres.app I want to make sure I'm laying the proper foundation for the eventual deployment of a Django application to Heroku. 我想确保为最终将Django应用程序部署到Heroku奠定适当的基础。

I've followed the steps in the postgres.app documentation but have a few additional questions: 我已经按照postgres.app文档中的步骤进行操作,但是还有其他一些问题:

  1. In my development environment (on a personal osx machine) is it okay to have the Django application connect to the database as the default/root user ($USER) without a password? 在我的开发环境中(在个人osx机器上),可以让Django应用程序以默认/ root用户($ USER)的身份无密码连接到数据库吗?

  2. If I wanted to set up a password for the default/root user, how should I go about doing so? 如果我想为默认/ root用户设置密码,该怎么办? I've attempted ALTER USER [username] with password '[password]'; 我尝试ALTER USER [username] with password '[password]'; and modifying ~/Library/Containers/com.heroku.postgres/Data/Library/Application Support/Postgres/var/pg_hba.conf with no success: entering psql in the terminal still provides unauthenticated access to the postgres shell. 并修改~/Library/Containers/com.heroku.postgres/Data/Library/Application Support/Postgres/var/pg_hba.conf没有成功:在终端中输入psql仍然提供未经身份验证的对postgres shell的访问。

  3. What is the correct way to connect to the postgres.app server with pgAdmin . pgAdmin连接到postgres.app服务器的正确方法是什么? My current setup is as follows. 我当前的设置如下。 I suppose I'm mostly concerned with whether the Maintenance DB setting is correct: 我想我最关心的是Maintenance DB设置是否正确:

    Name: development 名称:发展中
    Host: localhost 主机:localhost
    Port: 5432 端口:5432
    Maintenance DB: [$USER] # ie, "joe"... should this be "postgres" instead? 维护数据库:[$ USER]#即“ joe” ...应该改为“ postgres”吗?
    Username: [$USER] 用户名:[$ USER]
    Password: 密码:

Many thanks, and any additional advice is always appreciated! 非常感谢,任何其他建议,我们将不胜感激!

  1. I don't think OS X has a root user per se. 我不认为OS X本身具有root用户。 Semantics aside, yes it is ok to connect under your username. 除了语义,是的,可以使用您的用户名进行连接。 By default this role will not have superuser privileges. 默认情况下,此角色将没有超级用户特权。 If you need to make superuser type changes (adding/dropping databases, granting access, those kinds of things), the customary way to do this is to use su postgres to switch users to the entitled user, then use psql . 如果您需要更改超级用户类型(添加/删除数据库,授予访问权限,诸如此类的事情),则通常的做法是使用su postgres将用户切换为有资格的用户,然后使用psql

  2. By default, postgres uses unix usernames for authentication. 默认情况下,postgres使用unix用户名进行身份验证。 If you want to use username/passwords instead you need to change settings in pg_hba.conf per my answer here . 如果要使用用户名/密码,则需要根据此处的我的答案更改pg_hba.conf设置。

  3. I am not very familiar with pgAdmin--wish I could help. 我对pgAdmin不太熟悉,希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM