pages. • Three tiers: Presentation, application and storage. • Request response cycle. • Finally browser expects an html document which the server must provide. Basic Python knowledge While we talk about basic python, install the following: • sudo apt-get install pip • sudo apt-get install virtualenv • Pip • Virtualenv • Datastructures: list, dict and tuple. If you write plain python • Have to connect to database. • Write raw sql. • Have to think about development server. • User management. • Need to create the admin. • Session management. • And hell lot of other things like templating, url mapping etc. Django While we talk about Django, set the environment: • virtualenv django polls. • pip install django • pip install ipython 1
development. • DRY principle. • Code reusability and Pluggability. • Has an ORM. • Provides a web server for development. • Provides admin for CRUD. • And once done with basic work, it supports advanced things like Feeds, sitemap, caching and what not. Start writing code • startproject • runserver and show default django page • syncdb • Enable the admin • CRUD on User model • Poll and Choice model and Queryset api • Basic views and urls • Use url and reverse instead of hardcoding. Keeps the code DRY • Changing the views • Associating User with Poll and Choice • Allow only logged in users to vote • Profile page for user 2