New Site Architecture

From GCD
Jump to navigation Jump to search

Introduction

This page explains the architectural principles behind the GCD's new web site implementation. The goal is to make it clear to anyone participating in the project how the pieces fit together, where new code should be added for any given purpose, and how to find existing code in the tree.

The new site is written primarily in Python with a mysql back end. In addition to HTML/XHTML and CSS, the front end may employ some amount of JavaScript. The exact nature, amount and library usage of this JavaScript has yet to be determined. The application framework we are using is Django, which is discussed in more detail below.

The GCD will adhere to the following major architectural principles for the new site:

  • Application code will be organized along Model/View/Controller (MVC) lines, as facilitated by Django.
  • GCD data will be viewable in some clear and reasonable form on all browsers.


Django

Model

  • Models must have no awareness of controllers (Django views) or views (Django templates).
  • Models must be unaware of URLs.
  • Methods should be added to models only when they represent an attribute of the object that the model represents. For instance, a value that is calculated from multiple database columns, or one that might be read in different ways depending on settings (a cached count vs. executing a count on a related data set).

Controller (Django Views)

View (Django Templates)

Admin Site

Migration Tools

User Interface

HTML

  • HTML will be purely structural in nature. No inline style attributes or style markup.
  • HTML should be clear and readable with styles disabled or limited (such as on a mobile device or text browser).
  • Links should always result in a page most closely associated with the linking object. To clarify: a link through a series name should always land on some sort of series page, while an issue link should always land on some sort of issue page. The series or issue page may pull in additional information from other objects in some circumstances, but the primary presentation should reflect the object that the user clicked on.
  • Fields should not be overloaded. By "field" we mean any box, list item, paragraph, etc. used to hold specific data. Each such field should hold one or at most a small number of closely related items. Not a larger set run together in a sentence or separated only by punctuation.

CSS