Web apps in Python with Django
Introduction
View = URL (callback function) -> data
Template = how data is presented in the UI
Controller = Framework itself
Setup
Install Python (2.5+ is recommended, as it includes SQLite so you don't need
to bother installing a database to get started)
Download and untar the latest Django package
Open a terminal window, and type: setup.py install
In Windows, add this to the PATH env't variable: C:\Python25\Lib\site-packages\django\bin.
You might need to reboot for Windows to take notice.
Programming
C:\MyStuff\django>C:\Python25\Lib\site-packages\django\bin\django-admin.py
startproject mysite
A basic site includes:
- __init__.py: An empty file that tells Python that this directory should
be considered a Python package. (Read more about packages in the official
Python docs if you're a Python beginner.)
- manage.py: A command-line utility that lets you interact with this Django
project in various ways. You can read all the details about manage.py in
django-admin.py and manage.py.
- settings.py: Settings/configuration for this Django project. Django
settings will tell you all about how settings work.
- urls.py: The URL declarations for this Django project; a "table
of contents" of your Django-powered site. You can read more about URLs
in URL dispatcher.
python manage.py runserver.
Resources