KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'd like to keep development.ini and production.ini under version control, but for security reason would not want the sqlalchemy.url connection string to be stored, as this would contain the username and password used for the database connection. What's the canonical way, in Pyramid, of sourcing this setting from an additional external file? Edit In addition to solution using the environment variable, I came up with this solution after asking around on #pyramid: def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ # Read db password from config file outside of version control secret_cfg = ConfigParser() secret_cfg.read(settings['secrets']) dbpass = secret_cfg.get("secrets", "dbpass") settings['sqlalchemy.url'] = settings['connstr'] % (dbpass,)
Tags (comma-separated)
Save Edits
Cancel