Web Applications - Separating DB Connections

Stuart MacKay smackay at flagstonesoftware.com
Wed Jun 8 06:22:17 EDT 2011


A simple way to do this is use fabric for deployment. It allows you to 
upload a file as if it was a template and replaces any placeholder 
strings with values supplied when you upload. The values can be supplied 
either in a config file or interactively when the deployment takes place.

For my django deployments to a production server I have the database 
connection information in a config file that is separate from the app 
source. The name of the config file is passed on the command line when 
running the deployment.

See fabric.contrib.files.upload_template on 
http://docs.fabfile.org/en/1.0.1/api/contrib/files.html
and the --config option on http://docs.fabfile.org/en/1.0.1/usage/fab.html

Stuart MacKay
Lisbon, Portugal

> Hello Everyone:
>
>    I am trying to find a way to extract and remove database connection
> information (username, password, schema name) from the application
> source. I need to do this because in my organization - for security
> reasons - access to databases is controlled by a separate department;
> and as such, when a solution is deployed to production - the
> authentication credentials for the databases are changed (and not told
> to the development team).
>
>    Currently all development is done in Java and with that they have
> the ability to publish databases as a service in their application
> server; this way users can be granted access to modify the credentials
> to the JDBC data source without having to edit source code of the
> application being deployed.  I am looking for something similar in
> Python (short of using Jython).
>
> Thanks!




More information about the Python-list mailing list