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
4
560
Staticfiles : tout ce qu'il faut savoir, rien que ce qu'il faut savoir
Bruno Renié
April 14, 2012
Tweet
Share
More Decks by Bruno Renié
See All by Bruno Renié
Visibility for web developers
brutasse
3
460
Decentralization & real-time with PubSubHubbub
brutasse
1
160
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.6k
Packager son projet Django
brutasse
4
570
Introduction to Django
brutasse
3
430
Other Decks in Programming
See All in Programming
CSC307 Lecture 01
javiergs
PRO
0
640
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
200
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
180
ThorVG Viewer In VS Code
nors
0
500
Graviton と Nitro と私
maroon1st
0
160
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
160
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
170
SQL Server 2025 LT
odashinsuke
0
120
re:Invent 2025 トレンドからみる製品開発への AI Agent 活用
yoskoh
0
560
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
580
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2k
ゆくKotlin くるRust
exoego
1
180
Featured
See All Featured
Paper Plane
katiecoart
PRO
0
45k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Practical Orchestrator
shlominoach
190
11k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
AI: The stuff that nobody shows you
jnunemaker
PRO
1
40
Designing for Timeless Needs
cassininazir
0
110
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
140
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
100
Visualization
eitanlees
150
16k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
110
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
270
Everyday Curiosity
cassininazir
0
120
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