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
Staticfiles : tout ce qu'il faut savoir, rien q...
Search
Bruno Renié
April 14, 2012
Programming
590
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Staticfiles : tout ce qu'il faut savoir, rien que ce qu'il faut savoir
Bruno Renié
April 14, 2012
More Decks by Bruno Renié
See All by Bruno Renié
Visibility for web developers
brutasse
3
480
Decentralization & real-time with PubSubHubbub
brutasse
1
190
Deployability of Python Web Applications
brutasse
17
2.4k
Stop writing settings files
brutasse
21
2.6k
Class-based Views: patterns and anti-patterns
brutasse
9
1.7k
Packager son projet Django
brutasse
4
590
Introduction to Django
brutasse
3
460
Other Decks in Programming
See All in Programming
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
210
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
130
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
3
350
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
140
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
430
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
460
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
810
dRuby over BLE
makicamel
2
400
分散システム、なんですぐ死んでしまうん?耐障害性を高めたいあなたのためのレジリエンスパターン入門
mshibuya
2
340
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
140
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
1k
Featured
See All Featured
Accessibility Awareness
sabderemane
1
150
Speed Design
sergeychernyshev
33
1.9k
Why Our Code Smells
bkeepers
PRO
340
58k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
280
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.9k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
760
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
650
sira's awesome portfolio website redesign presentation
elsirapls
0
290
Design in an AI World
tapps
1
260
It's Worth the Effort
3n
188
29k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Transcript
Staticfiles tout rien que ce qu'il faut savoir Bruno Renié
Djangocong 2012
Django >= 1.4 django-staticfiles >= 1.2
MEDIA STATIC données dynamiques données statiques wat
STATIC_ROOT STATIC_URL STATICFILES_FINDERS STATICFILES_DIRS STATICFILES_STORAGE django-admin.py collectstatic
STATIC_ROOT STATIC_URL STATICFILES_FINDERS STATICFILES_DIRS STATICFILES_STORAGE django-admin.py collectstatic
Layout project/ app1/static/style.css app2/static/jquery.js app1 static app2 static
Configuration minimale # settings.py STATIC_URL = '/static/' # urls.py from
django.contrib.staticfiles.urls \ import staticfiles_urlpatterns urlpatterns += staticfiles_urlpatterns() # settings.py # urls.py
et c'est tout
Référencer un fichier {% load staticfiles %} {% static "jquery.js"
%} staticfiles static
app1/static/foo.css app2/static/foo.css {% static "foo.css" %} Conflits Comme les templates
foo.css foo.css "foo.css"
Namespaces Applications réutilisables / éviter les conflits app1/static/app1/foo.css app2/static/app2/foo.css {%
static "app2/foo.css" %} app1/foo.css app2/foo.css "app2/foo.css"
STATICFILES_DIRS Applications non-standard
En production # settings.py STATIC_ROOT = '/path/to/public/static' $ python manage.py
collectstatic # settings.py
et c'est tout
Cache busting STATICFILES_STORAGE = ( 'django.contrib.' 'staticfiles.storage.' 'CachedStaticFilesStorage' ) {%
static "foo.css" %} ↓ /static/foo.1cc9fe7eb4b9.css
{% static %} ♡ @brutasse