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
580
4
Share
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
470
Decentralization & real-time with PubSubHubbub
brutasse
1
170
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
580
Introduction to Django
brutasse
3
450
Other Decks in Programming
See All in Programming
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
290
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
450
TiDBのアーキテクチャから学ぶ分散システム入門 〜MySQL互換のNewSQLは何を解決するのか〜 / tidb-architecture-study
dznbk
1
180
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
2
550
実用!Hono RPC2026
yodaka
2
250
ルールルルルルRubyの中身の予備知識 ── RubyKaigiの前に予習しなイカ?
ydah
1
210
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
110
Kingdom of the Machine
yui_knk
2
750
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
190
アーキテクチャモダナイゼーションとは何か
nwiizo
19
5.4k
Programming with a DJ Controller — not vibe coding
m_seki
3
140
CDK Deployのための ”反響定位”
watany
5
800
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
260
Code Reviewing Like a Champion
maltzj
528
40k
So, you think you're a good person
axbom
PRO
2
2k
Bash Introduction
62gerente
615
210k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The Pragmatic Product Professional
lauravandoore
37
7.2k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
The Curious Case for Waylosing
cassininazir
0
310
Facilitating Awesome Meetings
lara
57
6.8k
Into the Great Unknown - MozCon
thekraken
41
2.4k
Raft: Consensus for Rubyists
vanstee
141
7.4k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
140
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