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
Django Static Stuff
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Matthew Dapena-Tretter
July 10, 2013
Programming
8.5k
6
Share
Django Static Stuff
Handling the Un-Django Parts of Your Django App
Matthew Dapena-Tretter
July 10, 2013
More Decks by Matthew Dapena-Tretter
See All by Matthew Dapena-Tretter
Isomorphic JS, Server-side Rendering, React & Rockefeller
matthewwithanm
3
230
The Life and Times of a React Component
matthewwithanm
1
200
Everyone's Happy: React, Server-side Rendering & SEO
matthewwithanm
2
1.2k
Conquering State
matthewwithanm
1
370
RequireJS in 15 Minutes
matthewwithanm
2
200
Other Decks in Programming
See All in Programming
20260320登壇資料
pharct
0
160
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
410
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
2
250
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
530
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
5
2.5k
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2.3k
PHPで TLSのプロトコルを実装してみる
higaki_program
0
740
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
240
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
970
Go_College_最終発表資料__外部公開用_.pdf
xe_pc23
0
130
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
340
The free-lunch guide to idea circularity
hollycummins
0
420
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
800
Music & Morning Musume
bryan
47
7.1k
GraphQLとの向き合い方2022年版
quramy
50
14k
Become a Pro
speakerdeck
PRO
31
5.9k
Everyday Curiosity
cassininazir
0
190
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.5k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Practical Orchestrator
shlominoach
191
11k
Code Reviewing Like a Champion
maltzj
528
40k
Transcript
STATIC STUFF Handling the Un-Django Parts of Your Django App
Matthew Tretter @matthewwithanm
[email protected]
github.com/matthewwithanm http://speakerdeck.com/matthewwithanm/django-static-stuff
Photo by Jeff Prouse http://www.flickr.com/photos/prousefamily/426140767/ Static files used to be
a small problem for Django devs
Photo by John R. Southern http://www.flickr.com/photos/krunkwerke/267608325 Now, they’re a much
larger problem
None
⃠
None
⃠
None
Photo by Brin F http://thumbsandammo.blogspot.com/2013/03/blog-post_4297.html
⃠ {% load static %}
def static(path): return settings.STATIC_URL + path
{% load staticfiles %}
{% load static from staticfiles %}
{% load static from staticfiles %} Delegates to STATICFILES_STORAGE
main.css main.af42991c673a.css Wow, this slide is boring. CachedStaticFilesStorage CachedFilesMixin
You can’t tell your users to clear their cache Far-future
FTW Safer deployments Photo by patriziasoliani http://www.flickr.com/photos/55524309@N05/5378314720/
Why not django-compressor?
input defined in templates doesn’t know about dependency graphs only
for js & css
Embrace the build step Photo by Phyllis Buchanan http://www.flickr.com/photos/pgautier/2598157781/
1.Collect the static files from all apps into temporary location
2.Perform the build 3.Collect the built files Photo by Spencer Garness http://www.flickr.com/photos/njorthr/4030750472/
None
sass/lessc coffee uglify.js csso Photo by Toni http://www.flickr.com/photos/toniandmatthew/5212240990/
sass/lessc coffee uglify.js csso Photo by Toni http://www.flickr.com/photos/toniandmatthew/5212240990/ r.js jpegtran
pngcrush svgo
sass/lessc coffee uglify.js csso r.js jpegtran pngcrush svgo ANYTHING It’s
still the same photo
Can we do better? Yeah, still. Sorry.
Embrace Django
Photo by Brin F. But it’s slightly different than before!
No it’s not. http://thumbsandammo.blogspot.com/2013/03/blog-post_4297.html
generate & consume static file manifests tweak post-processing improve collection
TL;DL
{% load staticfiles %}
Hashes in Filenames
Embrace the build step
Build on staticfiles app
Thanks http://speakerdeck.com/matthewwithanm/django-static-stuff https://gist.github.com/matthewwithanm/5969795 Matthew Tretter @matthewwithanm
[email protected]
github.com/matthewwithanm