On my dev machines, I'm using SQLite, so the database is the same 
regardless of what machine I'm using. In your case, you could set your 
db.py file to detect your machine's host name and use the appropriate DAL 
string accordingly.

For example:

import socket
hostname = socket.gethostname()

if hostname == 'dev1':
    db = DAL('postgres://123.45.168.90/mydb')
elif hostname == 'dev2':
    db = DAL('postgres://98.76.43.21/mydb')
else:
    # production database
    db = DAL('postgres://22.33.44.55/productiondb')


Another option, which I used to use is to set up the database on your 
primary dev machine (probably your home workstation), then when using your 
laptop, set up an SSH tunnel, forwarding the database port. You would still 
have to use the method above, since your laptop would see your home 
database server as running locally, but at least this way you can work with 
the same database all the time.

The second option may or may not be good for you, but that's up to 
you....I'm just making sure I give you a couple of options to chose from.

Reply via email to