I create a file in the models, and never commit it, called 0-
settings.py, that goes
w2p_settings['dbcon'] = 'whatevent://me:mypass@myhost/mydb'
then, on db.py
try:
db = DAL(w2p_settings['dbcon'])
except NameError:
db = DAL('somedb://someotherguy:hispassword@otherhost/somedb')
this has some advantages:
1. If this is open sourced, I don't give away my db password
2. All the main settings stay in one file, seperating it from acctual
code (models are code)
3. I can put the application in several domain, each with his own DB.
On Jan 11, 3:46 am, Joseph Jude <[email protected]> wrote:
> I use the below:
> is_local = request.client in ['127.0.0.1', 'localhost']
> if is_local:
> from local_settings import *
> else:
> from prod_settings import *
>
> I got local_settings.py & prod_settings.py. Through hgignore, I ignore
> prod_settings.py so it doesn't go to my public repo.
>
> P.S: since I run the site on webfaction where request.is_local returns true
> so I had to use the first line shortcut.
>
> Josephhttp://www.jjude.biz