This presentation is a simple tutorial about developing a note taking application using TurboGears2 python framework.
The tutorial is intended to get you familiarized with the updated turbogears2 python framework.
Additional documentation/explanation can be found at http://blog.fruiapps.com/2012/05/TurboGears2-tutorial-to-create-a-simple-MVC-application
TG2Notes tutorial: Create a simple note taking app with Turbogears2
1. Turbogears2 tutorial to
create an MVC App
This SlideShow is the continuation of the
documentation available here.
2. What is the app about?
Its a simple note taking application, that would
provide users the functionality to:
● create a new note
● delete a note
● edit a note
Lets get started!!
4. Create the app
● (tg2envi)$ paster quickstart TgDemo
● Enter package name [tgdemo]: tg2notes
○ Would you prefer mako templates? (yes/[no]): no
○ Do you need authentication and authorization in this
project? ([yes]/no): no ......
● (tg2envi)$ cd TgDemo
● (tg2envi)$ python setup.py develop
● (tg2envi)$ paster setup-app development.ini
● (tg2envi)$ paster serve development.ini
6. Model Design
The database fields that needs to be present
are:
● author
● note title
● note description
● subject
● date
Create a file called note.py in the model
directory. (content here)
7. Widget Design
We need to design the UI for the forms that will
be rendered in the templates.
Create a folder called widgets parallel to
controllers, add a file called forms.py.
We need to design the create form and edit
form, which will be rendered in the templates to
take/edit the notes. (content here)
8. Controllers Design
Stuff we need to take care:
● The file root.py in folder controllers is the
right place to do things.
● Import the necessary libraries.
● Include the forms we designed.
● Mention the database and session
● Put the following content.
9. Done
We are done, we just used
CrudRestController,
feature from turbogears to design the above
application.
You might:
1. write to us your doubts/suggestions /queries
to contact@fruiapps.com.
2. share the presentation.
3. follow us on twitter @fruiapps