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
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
160
re:Invent 2025 トレンドからみる製品開発への AI Agent 活用
yoskoh
0
480
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
990
Vibe codingでおすすめの言語と開発手法
uyuki234
0
130
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
220
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
420
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
200
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
420
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
170
Cell-Based Architecture
larchanjo
0
150
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
280
Python札幌 LT資料
t3tra
7
1.1k
Featured
See All Featured
Joys of Absence: A Defence of Solitary Play
codingconduct
1
260
Writing Fast Ruby
sferik
630
62k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
110
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
A Soul's Torment
seathinner
1
2k
Embracing the Ebb and Flow
colly
88
4.9k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
73
End of SEO as We Know It (SMX Advanced Version)
ipullrank
2
3.8k
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