Re: Specifying Host With psycopg2

From: "Ewan, Michael" <michael(dot)ewan(at)intel(dot)com>
To: wes <pdxpug(at)the-wes(dot)com>, Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: "pdxpug(at)postgresql(dot)org" <pdxpug(at)postgresql(dot)org>
Subject: Re: Specifying Host With psycopg2
Date: 2011-10-21 18:12:40
Message-ID: 66C9C47441840949A66773F8F0D9D6A701862480B3@rrsmsx503.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

Also, FQDN is always more reliable than 'localhost', and allows the database to be somewhere else. I also recommend the config file approach.

From: pdxpug-owner(at)postgresql(dot)org [mailto:pdxpug-owner(at)postgresql(dot)org] On Behalf Of wes
Sent: Friday, October 21, 2011 8:11 AM
To: Rich Shepard
Cc: pdxpug(at)postgresql(dot)org
Subject: Re: [pdxpug] Specifying Host With psycopg2

Interesting that your email has a date of 7 days ago, but only showed up now. Maybe you got moderated?

Since this can be different from user to user, you should take the easy way out and make the hostname configurable by the end-user. Something like a configuration file with hostname, username, password, and perhaps database name.

If you hard-code any of these things, you are asking for trouble.

-wes
On Fri, Oct 14, 2011 at 8:43 AM, Rich Shepard <rshepard(at)appl-ecosys(dot)com<mailto:rshepard(at)appl-ecosys(dot)com>> wrote:
I'm nut sure whether this is the appropriate list for my question; perhaps
it belongs on the local python mail list. So, I'll ask:

To identify the postgres host when establishing a connection to the
database, should I use 'localhost,' the server's host name, or a
fully-qualified path/host name?

I'm asking because now I'll be developing and using this application here
but eventually my client and a state regulatory agency will be using it on
their Windows-based networks. My learning now just how to define the
database host will make it easier for me when it comes time to provide the
core python model to others.

Rich

--
Sent via pdxpug mailing list (pdxpug(at)postgresql(dot)org<mailto:pdxpug(at)postgresql(dot)org>)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pdxpug

In response to

Browse pdxpug by date

  From Date Subject
Next Message gabrielle 2011-11-04 03:25:42 November meeting in two weeks
Previous Message wes 2011-10-21 15:10:55 Re: Specifying Host With psycopg2