+ All Categories
Home > Documents > Who uses it? MichaelMoore.com What's it all about? Rapid Development Clean, Pragmatic Design.

Who uses it? MichaelMoore.com What's it all about? Rapid Development Clean, Pragmatic Design.

Date post: 01-Jan-2016
Category:
Upload: richard-fitzgerald
View: 215 times
Download: 2 times
Share this document with a friend
21
Transcript

Who uses it?MichaelMoore.com

What's it all about?

• Rapid Development

• Clean, Pragmatic Design

MVC -> MTV

Except in their terminology, the "view" is the controller and the "template" is the view, kind of

• Model

• URLconf

• Template

• View

Model Layer

Each model maps to a single database table

Django comes with a built in ORM

Model Layer

Model Fields

Django offers field options and field types

Examples:

• Field.default returns default value of a field

• Field.primary_key returns true if the field is the primary key

SQL

Django has an API for CRUD

Databases

• SQLite - Default with Python

• PostgreSQL

• MySQL

• Oracle

• Or you can write your own engine.

URLconf

Maps regex to view

Web Server Gateway Interface (WSGI)

Python standard for web servers to communicate with web applications

View Layer

Python function that takes a Web request and returns a Web response.

Response Can Be

• HTML contents of a Web page

• Redirect

• 404 error

• XML document

• Image

• anything, really.

View Layer

Template Layer

This is the "view" in most web frameworks

Can contain block tags or variables

• A block tag is a symbol within a template that does something; surrounded by "{%" and "%}"

• A variable is a symbol within a template that outputs a value; surrounded by "{{" and "}}"

Template Layer

Similar to PHP

StructureRoot

Apps URLconf LibrariesWSGI

App Directories

Models TestsViews Templates

IDEs

• PyDev Eclipse Plugin

• PyCharm

• Komodo IDE

• Netbeans

• IntelliJ IDEA

• Ninja IDE

• Eric Python IDE

• Wing IDE

• Basic Text Editors (Komodo, VIM)

Conclusion

• Django is great for fast development from scratch

• Not great for integrating with legacy databases, although it is possible

References

Django's Website


Recommended