Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Django
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Mahdi Yusuf
May 21, 2015
Programming
530
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction to Django
Small talk I did for our local Python Group!
Mahdi Yusuf
May 21, 2015
More Decks by Mahdi Yusuf
See All by Mahdi Yusuf
Eight Fallacies of Distributed Systems
myusuf3
0
75
Better Health Insights by Unlocking Data
myusuf3
0
130
Optimizing Your Life
myusuf3
1
160
How To Make Friends and Influence Developers
myusuf3
3
1.2k
Twisted History of Python Packaging
myusuf3
11
15k
Other Decks in Programming
See All in Programming
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
600
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.2k
AIで効率化できた業務・日常
ochtum
0
140
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
180
Lessons from Spec-Driven Development
simas
PRO
0
220
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
730
エージェンティックRAGにAWSで入門しよう!
har1101
9
1.7k
New "Type" system on PicoRuby
pocke
1
1k
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.8k
Oxcを導入して開発体験が向上した話
yug1224
4
330
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
180
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
800
Featured
See All Featured
Designing Powerful Visuals for Engaging Learning
tmiket
1
420
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
370
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
ラッコキーワード サービス紹介資料
rakko
1
3.7M
KATA
mclloyd
PRO
35
15k
The SEO identity crisis: Don't let AI make you average
varn
0
500
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
310
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
170
Transcript
Introduction to Django @myusuf3 because who reads documentation
What is Django? The D is silent.
BlogIt The future of online writing, maybe.
$ django-admin startproject blogit blogit ├── blogit │ ├── __init__.py
│ ├── settings.py │ ├── urls.py │ └── wsgi.py └── manage.py
$ django-admin startapp blog * be sure to add new
app in settings file
from django.db import models class Author(models.Model): name = models.CharField(max_length=50) class
Blog(models.Model): title = models.CharField(max_length=200) text = models.TextField() pub_date = models.DateTimeField('date published', auto_now_add=True,) author = models.ForeignKey(Author)
$ python manage.py makemigrations blog
Migrations for 'blog': 0001_initial.py: - Create model Author - Create
model Blog
$ python manage.py migrate
Operations to perform: Synchronize unmigrated apps: staticfiles, messages Apply all
migrations: admin, blog, contenttypes, auth, sessions Synchronizing apps without migrations: Creating tables... Running deferred SQL... Installing custom SQL... Running migrations: Rendering model states... DONE Applying blog.0001_initial... OK
View from Top The steward of control
def post(request, post_id): post = get_object_or_404(Blog, pk=post_id) return render(request, 'post.html',
{'post': post})
Templates and Rendering Making things look beautiful
<h1>{{ post.title }}</h1> <h4> Posted: {{ post.pub_date }}</h4> <h4>Author: {{post.author.name}}</h4>
<p> {{post.text}} </p>
Feature Request! CEO has epiphany!!
def latest(request): posts = Blog.objects.all() return render(request, 'posts.html', {'posts': posts})
{% for post in posts %} <h1>{{ post.title }}</h1> <h4>
Posted: {{ post.pub_date }}</h4> <h4>Author: {{post.author.name}}</h4> <p> {{post.text}} </p> {% endfor %}
Requirements Got a list checking it twice!
dj-database-url==0.3.0 dj-static==0.0.6 Django==1.8 gevent==1.0.1 greenlet==0.4.5 gunicorn==19.3.0 honcho==0.6.6 psycopg2==2.6 static3==0.5.1 static==1.1.1
What is Deploying? The D isn’t silent, just like in
the word difficult.
Inquiries? @myusuf3 Do something magical now!