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
Matthew Dapena-Tretter
July 10, 2013
Programming
6
8.5k
Django Static Stuff
Handling the Un-Django Parts of Your Django App
Matthew Dapena-Tretter
July 10, 2013
Tweet
Share
More Decks by Matthew Dapena-Tretter
See All by Matthew Dapena-Tretter
Isomorphic JS, Server-side Rendering, React & Rockefeller
matthewwithanm
3
220
The Life and Times of a React Component
matthewwithanm
1
190
Everyone's Happy: React, Server-side Rendering & SEO
matthewwithanm
2
1.2k
Conquering State
matthewwithanm
1
360
RequireJS in 15 Minutes
matthewwithanm
2
190
Other Decks in Programming
See All in Programming
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
39k
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.6k
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
660
Data-Centric Kaggle
isax1015
2
520
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
170
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
170
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
3
1.5k
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
190
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
220
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
190
AI 駆動開発ライフサイクル(AI-DLC):ソフトウェアエンジニアリングの再構築 / AI-DLC Introduction
kanamasa
11
5.4k
AtCoder Conference 2025
shindannin
0
940
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
0
2M
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
41
Optimizing for Happiness
mojombo
379
70k
Amusing Abliteration
ianozsvald
0
87
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
190
Joys of Absence: A Defence of Solitary Play
codingconduct
1
270
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
47
Scaling GitHub
holman
464
140k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
0
1k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
180
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
We Are The Robots
honzajavorek
0
130
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