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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Bruno Renié
April 14, 2012
Programming
570
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
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
270
おれのAgentic Coding 2026/03
tsukasagr
1
120
AI活用のコスパを最大化する方法
ochtum
0
370
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
330
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
120
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
8
4.1k
ファインチューニングせずメインコンペを解く方法
pokutuna
0
250
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
110
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
540
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
150
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
320
RSAが破られる前に知っておきたい 耐量子計算機暗号(PQC)入門 / Intro to PQC: Preparing for the Post-RSA Era
mackey0225
3
110
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
160
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
320
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
130
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
470
Building Applications with DynamoDB
mza
96
7k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
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