InterviewSolution
| 1. |
How Do I Deploy My Configuration And A Default Database? |
|
Answer» From TurboGears version 1.0.4b3 onwards it is easy to include a default configuration file in your application’s egg file, which then will be found by the standard start script automatically. You just have to uncomment a section in your project’s setup.py file, which is appropriatly commented. While, in principle, one could also include a default database in the egg, this would only MAKE sense for single-file databases, like those used by SQLite, but then again, one wouldn’t normally want to write to FILES contained in an egg. One SOLUTION is to provide a custom tg-admin command for your application, that asks the user for the database connection parameters and then initializes the database using the tg-admin sql create command FOLLOWED by some custom code to fill the the dadabase with some bootstrap data. From TurboGears version 1.0.4b3 onwards it is easy to include a default configuration file in your application’s egg file, which then will be found by the standard start script automatically. You just have to uncomment a section in your project’s setup.py file, which is appropriatly commented. While, in principle, one could also include a default database in the egg, this would only make sense for single-file databases, like those used by SQLite, but then again, one wouldn’t normally want to write to files contained in an egg. One solution is to provide a custom tg-admin command for your application, that asks the user for the database connection parameters and then initializes the database using the tg-admin sql create command followed by some custom code to fill the the dadabase with some bootstrap data. |
|