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
ゆくKotlin くるRust
exoego
1
200
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
660
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
530
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
190
TestingOsaka6_Ozono
o3
0
270
AIエージェントの設計で注意するべきポイント6選
har1101
6
3.1k
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
7
4.3k
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
940
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
360
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.3k
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
170
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
4
2.4k
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
200
From π to Pie charts
rasagy
0
110
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.5k
Six Lessons from altMBA
skipperchong
29
4.1k
Optimizing for Happiness
mojombo
379
70k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
39
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
52
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
61
48k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Paper Plane (Part 1)
katiecoart
PRO
0
3.1k
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