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
440
Other Decks in Programming
See All in Programming
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
220
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
130
The Less-Told Story of Socket Timeouts
coe401_
3
310
アーキテクチャモダナイゼーションとは何か
nwiizo
19
5.3k
Alternatives to JPA 2026
debop
0
110
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
2
180
JAWS-UG横浜 #100 祝・第100回スペシャルAWS は VPC レスの時代へ
maroon1st
0
150
Running Swift without an OS
kishikawakatsumi
0
840
ドメインイベントでビジネスロジックを解きほぐす #phpcon_odawara
kajitack
3
780
Oxlintとeslint-plugin-react-hooks 明日から始められそう?
t6adev
0
270
10 Tips of AWS ~Gen AI on AWS~
licux
5
410
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
110
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
99
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Everyday Curiosity
cassininazir
0
200
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
490
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
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