Your SlideShare is downloading. ×
Django (and all that jazz)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Django (and all that jazz)

1,588
views

Published on

Django for beginners

Django for beginners

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,588
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
40
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Django (and all that jazz)‏
  • 2. Overview
    • Python framework
    • MTV (MVC)‏
    • Loosely coupled
    • Nice URLs
    • Friendly / powerful templating
  • 3. Python
    • Readable
    • Pythonic (“import this”)‏
    • Batteries included (contrib)‏
    • Simple / Powerful data structures
    • Interactive shell
  • 4. Basics (making it work)‏
    • django-admin.py / manage.py
    • projects
    • applications
    • django-admin.py startproject <stuff>
    • manage.py runserver
    • http://localhost:8000
  • 5. File Structure
    • manage.py startapp appname
    • settings.py
    • urls.py
    • appname/models.py
    • appname/views.py
  • 6. Configuring (settings.py)‏
    • Dynamic - configured in programmatic Python
    • Uses Python's native data structures
    • Setup globals (eurgh etc)‏
    • Configure databases (MySQL, PostGre, SQLite)‏
    • Installed apps (admin, auth, appname)‏
  • 7. Models
  • 8. Models (sorry)‏
    • Each class inherits from models.Model
    • To pull in from another table:
      • user = models.ForeignKey(User, unique=True)‏
    • Each field maps directly to a class member:
      • days_remaining = models.IntegerField()‏
    • Mapped with syncdb admin command
  • 9. How do we see that content?
    • admin app: “It’s not just scaffolding — it’s the whole house”
    • pre-installed as django.contrib.admin
    • add to installed_apps in settings.py
    • syncdb once more
    • Then there's one more step...
  • 10. Hooking it up (urls.py)‏
    • URL routing achieved through regex
    • backreferences used to identify parameters
    • Very loosely decoupled
    • include app-specific url routers:
      • (r'^admin/', include(django.contrib.admin.urls'))‏
      • http://localhost:8000/admin
    • make the string look nicer

×