Professional Documents
Culture Documents
bersicht
Vorstellung Was ist Django? Architektur Code Django Roadmap
Markus Zapke-Grndemann
Softwareentwickler seit 2001 Softwareentwicklung mit Python, Django
und Mercurial
Bildquelle: http://en.wikipedia.org/wiki/File:Django_Reinhardt_%28Gottlieb_07301%29.jpg
www.djangoproject.com
Ponies?
Ponies?
Architektur
MTV
Webserver
Webserver
Webserver URLConf
View
View
View
Model (ORM)
View
Model (ORM)
View
Model (ORM)
Datenbank
View
Model (ORM)
Datenbank
View
Model (ORM)
Datenbank
View
Model (ORM)
Datenbank
View
Model (ORM)
Template
Datenbank
View
Model (ORM)
Template
Datenbank
View
Model (ORM)
Template
Datenbank
View
Model (ORM)
Template
Datenbank
View
Model (ORM)
Template
Datenbank
View
Model (ORM)
Template
Datenbank
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter)
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML)
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom)
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Formulare
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Formulare Validation
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Formulare Validation File Storage Authentizierung Testing Caching i18n & l10n
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Formulare Validation File Storage Authentizierung Testing Caching i18n & l10n Middleware
Object Relational Mapper Admin URLConf Views Templates (Tags & Filter) Sessions Serializer (JSON, XML,YAML) Syndication (RSS, Atom) GeoDjango (GIS)
Formulare Validation File Storage Authentizierung Testing Caching i18n & l10n Middleware Security
Code
$ pip install django $ django-admin.py startproject myproject $ tree myproject myproject !"" manage.py #"" myproject !"" __init__.py !"" settings.py !"" urls.py #"" wsgi.py
$ python manage.py startapp pages $ tree . !"" manage.py !"" myproject ... #"" pages !"" __init__.py !"" models.py !"" tests.py #"" views.py
myproject/pages/models.py
from django.db import models class Page(models.Model): title = models.CharField(u'Titel', max_length=100) slug = models.SlugField(unique=True) body = models.TextField(u'Inhalt') class Meta: verbose_name = u'Seite' verbose_name_plural = u'Seiten' def __unicode__(self): return self.title
myproject/pages/admin.py
from django.contrib import admin from .models import Page class PageAdmin(admin.ModelAdmin): prepopulated_fields = {'slug': ['title']} admin.site.register(Page, PageAdmin)
myproject/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), )
http://127.0.0.1:8000/willkommen-auf-der-startseite/
myproject/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^', include('pages.urls')) )
myproject/pages/urls.py
from django.conf.urls import patterns, include, url urlpatterns = patterns('pages.views', url(r'^(?P<slug>[-\w]+)/$', 'detail'), )
myproject/pages/views.py
from django.shortcuts import get_object_or_404, render from .models import Page def detail(request, slug): page = get_object_or_404(Page, slug=slug) context = {'object': page} return render(request, 'pages/detail.html', context)
myproject/templates/base.html
<!doctype html> <body> <h1>My Website</h1> {% block content %}{% endblock %} </body> </html>
myproject/pages/templates/pages/detail.html
{% extends "base.html" %} {% block content %} <h2>{{ object.title }}</h2> <p>{{ object.body|linebreaks }}</p> {% endblock %}
Django Roadmap
Stabile API Minor Release alle neun Monate Klare Deprecation Timeline Ab Django 1.5 experimentelle Python 3.3
Untersttzung
Entwicklungsprozess
Deployment
Templates anlegen
Inhalte erstellen
Views anlegen
Django in Zahlen
Django in Zahlen
6.000.000 Besucher der Website pro Monat
Django in Zahlen
6.000.000 Besucher der Website pro Monat 21.700 Abonnenten der django-users Mailing Liste
Django in Zahlen
6.000.000 Besucher der Website pro Monat 21.700 Abonnenten der django-users Mailing Liste > 2.000 Packages im Python Packaging Index (> 10%)
Django in Zahlen
6.000.000 Besucher der Website pro Monat 21.700 Abonnenten der django-users Mailing Liste > 2.000 Packages im Python Packaging Index (> 10%) 33 Kern-Entwickler
Django in Zahlen
6.000.000 Besucher der Website pro Monat 21.700 Abonnenten der django-users Mailing Liste > 2.000 Packages im Python Packaging Index (> 10%) 33 Kern-Entwickler > 65 bersetzungen
ZDF - Die letzte Spur Washington Post Rdio Vodafone Mozilla Add-Ons
ZDF - Die letzte Spur Washington Post Rdio Vodafone Mozilla Add-Ons Discovery Channel
ZDF - Die letzte Spur Washington Post Rdio Vodafone Mozilla Add-Ons Discovery Channel VMWare
ZDF - Die letzte Spur Washington Post Rdio Vodafone Mozilla Add-Ons Discovery Channel VMWare Disqus
ZDF - Die letzte Spur Washington Post Rdio Vodafone Mozilla Add-Ons Discovery Channel VMWare Disqus Instagram
ZDF - Die letzte Spur Washington Post Rdio Vodafone Mozilla Add-Ons Discovery Channel VMWare Disqus Instagram National Geographic
ZDF - Die letzte Spur Washington Post Rdio Vodafone Mozilla Add-Ons Discovery Channel VMWare Disqus Instagram National Geographic The New York Times
http://robhudson.github.com/django-debug-toolbar/
http://robhudson.github.com/django-debug-toolbar/
http://robhudson.github.com/django-debug-toolbar/
Modular Search
http://haystacksearch.org/
www.djangopackages.com
Fragen?
www.inqbus.de www.keimlink.de @keimlink