I'm not sure there's a "standard" way of doing it if you're not using
sqlite, but I personally have the database pointing to a name in my
hosts file. So I'll configure "configdbhost" to be my configuration
database (in the hosts file on the box) and then have the lines (split
so that if the application is deployed on "apptest" application, it
points to a test database):
if request.application == 'apptest':
    # Test db
    db = DAL('postgres://configdbhost/apptest')
else:
    # Prod DB
    db = DAL('postgres://configdbhost/mydb')

On Tue, Jan 10, 2012 at 9:25 AM, Jonathan Lundell <jlund...@pobox.com> wrote:
> On Jan 10, 2012, at 6:04 AM, Jim Steil wrote:
>
>> I'm looking for input on how people manage their database connection when 
>> setting up your app in a Mercurial repository.
>>
>> If I just add my app and db.py to my repository, then every time I setup a 
>> different development machine to access it, the app will, by default, point 
>> to the same database.  But, this database connection isn't correct when I'm 
>> working on my laptop or from a home workstation and therefore, I need a 
>> different way to specify my db connection info.
>>
>> The solution I've come up with is to have a config file (using configobj) 
>> hold my db information, and read it in db.py to get the info.  But, then 
>> this causes even more overhead on each request.
>>
>> Also, what do you do about your databases sub-directory?  I would think that 
>> I don't want to track any changes there, but when my repo gets cloned an 
>> empty databases directory should be placed there.
>
> web2py should create the databases subdirectory for you if it's not there (at 
> the beginning of the first request).

Reply via email to