32
DJANGO The webframework for perfectionists with deadlines

Warum istdjangosocool

Embed Size (px)

DESCRIPTION

Eine sehr kurze Vorstellung des Webframeworks Django

Citation preview

Page 1: Warum istdjangosocool

DJANGOThe webframework for perfectionists with deadlines

Page 2: Warum istdjangosocool

Wie liefen die Übungen bei euch?War doch ganz easy oder ?

Page 3: Warum istdjangosocool

Wie liefen die Übungen bei euch?Eher doch nicht?

Page 4: Warum istdjangosocool

Wir bauen uns ein Content Management System…

Page 5: Warum istdjangosocool

Was braucht man dafür alles?

Seitenverwaltung

RSS-FeedsBenutzerverwaltung

Adminpanel

DatenbankWeblog

Dat

enba

nkab

frag

en

Page 6: Warum istdjangosocool

Wie lange braucht man dafür wohl?

Page 7: Warum istdjangosocool

Mit Django brauchst du dafür…

einzigenTag

Einen

Page 8: Warum istdjangosocool

Mit Django brauchst du dafür…

WTF ?!

Page 9: Warum istdjangosocool

Wo ist Django entstanden?

World OnlineEnge Deadlines

Ständig neue Anforderungen

Oft nur wenige Stunden

Page 10: Warum istdjangosocool

Wer verwendet Django?

App Engine

Page 11: Warum istdjangosocool

Wer verwendet Django?

Page 12: Warum istdjangosocool

Wer verwendet Django?

Page 13: Warum istdjangosocool

Wer verwendet Django?

NEBULA

Page 14: Warum istdjangosocool

Wer verwendet Django?

Page 15: Warum istdjangosocool

Was also macht Django besonders?

Page 16: Warum istdjangosocool

Django ist in Python geschrieben

Page 17: Warum istdjangosocool

Python ist elegant

Simple is better than complex.

Readability counts.

There should be one-- and preferably only one --obvious way to do it.

Page 18: Warum istdjangosocool

Python ermöglicht sehr schnelle Entwicklung

"Python is fast enough for our site and allows us to produce maintainable features in record times, with a minimum of developers," said Cuong Do, Software Architect,YouTube.com.

Page 19: Warum istdjangosocool

Python wird von der Elite benutzt

Page 20: Warum istdjangosocool

Django folgt der MVC-Architektur… oder so ähnlich

View

Template

Model

Database

Page 21: Warum istdjangosocool

Django folgt der MTV-Architektur!

Page 22: Warum istdjangosocool

Django macht alle Datenbankarbeit für dich

Object Relational

Mapper (ORM)

Database

Object1

Foo{}

Object2

Foo{}

Kein SQL nötig!

Python-only development

Höhere Produktivität

Page 23: Warum istdjangosocool

Django erzeugt deinen Adminbereich automatisch

Ein komplettes Admininterfacein nur 2 Minuten!

Page 24: Warum istdjangosocool

Django-App: Simple Poll

1. Projekt anlegen

>> django-admin.py startproject mysite

2. App anlegen

>> python manage.py startapp simplepolls

Page 25: Warum istdjangosocool

Simple Poll: Datenmodell erstellen

Tatort: models.py

from django.db import models

class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published')

class Choice(models.Model): poll = models.ForeignKey(Poll) choice = models.CharField(max_length=200) votes = models.IntegerField()

Page 26: Warum istdjangosocool

Simple Poll: Datenbank erzeugen

>> python manage.py syncdb

Page 27: Warum istdjangosocool

Simple Polls: Template erstellen

Tatort: polls/index.html{% if latest_poll_list %} <ul> {% for poll in latest_poll_list %} <li> <a href="/polls/{{ poll.id }}/">{{ poll.question }}</a> </li> {% endfor %} </ul> {% else %} <p>No polls are available.</p> {% endif %}

Page 28: Warum istdjangosocool

Simple Polls: View erstellen

Tatort: polls/views.py

from django.shortcuts import render_to_responsefrom polls.models import Poll

def index(request): latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5] return render_to_response('polls/index.html', {'latest_poll_list': latest_poll_list})

Page 29: Warum istdjangosocool

Simple Polls: Adminbereich erstellen

settings.pyINSTALLED_APPS = ( […] 'django.contrib.admin', […])

urls.pyDrei Zeilen einkommentieren…python manage.py syncdb

Done!

Page 30: Warum istdjangosocool

Was gibt es noch?

pretty url configinternationlization

caching

authentication 

commentsGeoDjango

session management

syndication feeds

file handling/storage

forms logging

Und noch viel mehr…

Page 31: Warum istdjangosocool

Fragen!

Page 32: Warum istdjangosocool

Django-Links

djangoproject.com

djangobook.com

djangopackages.com

pydev.org