Sticktime Publishing


Djangonautics

Building Awesome Websites with Django

Django (Yumalish.com) is what is known as a web development framework. Django runs on top of a well-known computer programming language called Python. Django simplifies many common tasks that must be carried out when building a website, In addition Django encourages the web developer, sometimes gently and at other times more forcefully, to adhere to what the information technology community largely believes to be the best way to go about the construction of a website--what they call "best practices."

Whether building a website for themselves or for a client or friend, many considerations present themselves for the developer who truly cares about quality craftsmanship:

The Path

What happens when you type a web address into your browser's address bar or click on a hyperlink in a webpage?

In a nutshell, when you surf to a webpage on the world wide web, your web browser establishes a connection to a web server. Specifically, the web server that holds the resource you are interested in accessing. A resource doesn't have to be a document or webpage. it could be a JavaScript game, a picture, an audio track, a PDF or ZIP file. A web server is just a special kind of program that runs on any regular old computer. The web server sits and waits for requests and then fulfills those requests.

The Rookie Way vs. the Django Way

The Rookie Way

The Django Way

Models

Models represent the format of your data. When they talk about "data-driven websites" this is it. Instead of embedding data into static webpages where they are displayed to the user only one way, that data can instead be put into a database. Your Django-powered website can then fetch that data from the database and present it to the user in countless different configurations. When your data is in a database it becomes a trivial matter to display it as a list ordered alphabetically, by date, or any other data element present.

Abstract Base Classes

There will be a lot of times when you need two or more tables that have a lot of common elements. One common example might be when you need to keep track of customers, suppliers and employees. While you could create another data element in a single model that keeps track of customers, vendors and employees, for various reasons you might need or want to keep that data as three separate tables. Let's say hypothetically that for legal reasons employee info can't comingle with customer info.

Django comes with a very handy

Miscellaneous Notes and Tips