I have a model file "0_globals.py" which I have under source control.  It 
defines overall constants for the site, including the connection string. 
 On each development machine I have a file "1_locals.py" which overrides 
selected variables in the globals file.  It is NOT under source control and 
is unique for each development machine (since I code from a variety of 
machines).

Model files are loaded in alphabetical order, so the 0_globals file is 
loaded first, then some constants are overwritten by 1_locals.  This is 
simple and "grut" but it works amazingly well.  It also works without any 
special features of the source code control system (I don't use git but 
mercurial).

-- Joe B.

Globals
# coding: utf8
from gluon import current
from gluon.storage import Storage
from gluon.custom_import import track_changes

settings = Storage()
current.settings=settings

# Override any settings in a file called 1-locals.py
# but do NOT include the local file in the HG repo
# AVOID changing this file, which IS in the repo.

settings.title = 'My Wunnerful Website'
settings.subtitle = XML('Some clever tagline goes here!')
settings.author = 'me_ofcourse'
settings.author_email = '[email protected]'
settings.keywords = ''
settings.description = ''
settings.layout_theme = 'Default'
settings.formstyle = 'bootstrap'
settings.table_page_size = 25
settings.upload = None
settings.fake = False
settings.scheduler = True
settings.use_blob = False
settings.migrate = True
settings.migrate2 = True
settings.lazy = True
settings.database_uri = 'postgres://wouldntyoulike:toknow@localhost/mydb'
settings.pool_size = 10
track_changes(True)
# stripe DEVELOPMENT keys.
settings.stripe_secret = 'sk_test_sorrynocanseesecretkey'
settings.stripe_public = 'pk_test_sorrynocanseepublickey'
# janrain keys.
settings.janrain_key = 'somebiggobbledygookkeyhere'
settings.janrain_domain = 'secure-swim-smarter.com'
settings.janrain_appid = 'anotherrandomlookingthinghere'
T.current_languages = ['null']

Locals:
# code: utf8
# Settings for site on my iMac computer

settings.migrate = False
settings.migrate2 = False
#settings.lazy = False
#settings.database_uri = 'postgres://mylocalname:andpassword@localhost/mydb'
#settings.pool_size = 10
#track_changes(False)
#settings.use_blob = False
settings.scheduler = False
#settings.fake = True





On Sunday, February 16, 2014 1:20:05 PM UTC-8, Tim Richardson wrote:
>
> postgres has peer authentication. 
> If I have mapped OS user www-data to a postgres role, and if apache runs 
> as www-data, can I use peer authentication in web2py and therefore not code 
> a password in?
> It seems that the connection string is parsed for user and password.
>
> The main reason I want to avoid a password is that it having a different 
> password in development and production becomes a nuisance. 
> However, everyone must have this inconvenience; what's the solution that 
> I'm missing? (I use git between development and production)
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to