Changeset 5655
- Timestamp:
- 11/03/08 17:43:38 (2 months ago)
- Files:
-
- docs/2.0/docs/main/Wiki20/wiki20.rst (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
docs/2.0/docs/main/Wiki20/wiki20.rst
r5654 r5655 309 309 310 310 Before you can use your database, you need to initialize it and add some data. 311 The easiest way to do this is just to run aPython script. Create a file called311 There's some built in support for this in TurboGears, but one of the easiest ways to do this is just to run a standard Python script. Create a file called 312 312 **initializeDB.py** in the ``Wiki-20`` directory containing the following: 313 313 314 314 315 315 .. code:: wiki_root/trunk/initializeDB.py 316 317 If you're familiar with SQLAlchemy this should look pretty standard to you. The only part that's different is that we use:: 318 319 transaction.commit() 320 321 where you're used to seeing ``Session.commit()`` we use ``transaction.commit`` this calls the transaction manager which helps us to support cross database transactions, as well as transactions in non relational databases, but ultimately in the case of SQLAlchemy it calls Session.commit() just like might if you were doing it directly. 316 322 317 323 Now run the program from the ``Wiki-20`` directory: