Peter's Blog

Redefining the Impossible

Turbogears using the wrong database


Turbogears supports two configurations, development and server, each with it's own configuration file. This is handy because I can use different databases for development and production and avoid breaking the production system while developing.

I've just moved the development database to the same server as the production database as using mysql instead of sqlite makes it easier for me to upgrade tables by dumping the sql, running "tg-admin sql drop; tg-admin sql create" and reimporting the old sql.

Just tried this on the production system and fried the development database. Why? It seems that turbogears decides whether it is running in development or production mode based on the existance of a setup.py file in the project directory. In my setup I copy all the files from the development directories on windows to the production directories on the server, I don't mess with python setup tools. Hence my production server has a copy of setup.py and so was deciding to use the development database.

I don't want to start hacking the turbogears source so I've hidden the setup.py file on the production server and modified the rsync script that I use to upload the database so that it doesn't upload setup.py.


Filed under: python turbogears

Have Your Say

I welcome constructive comments or questions but I reserve the right to delete any comments that displease me.

Who are you?

(Optional) If you enter an email address here I might email you back. Your email address will not be sold to spammers or shown anywhere

What do you have to say?