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
470
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
SourceGeneratorのススメ
htkym
0
200
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
150
AgentCoreとHuman in the Loop
har1101
5
250
ノイジーネイバー問題を解決する 公平なキューイング
occhi
0
110
生成AIを活用したソフトウェア開発ライフサイクル変革の現在値
hiroyukimori
PRO
0
110
2026年 エンジニアリング自己学習法
yumechi
0
140
Fluid Templating in TYPO3 14
s2b
0
130
MUSUBIXとは
nahisaho
0
140
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
390
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.5k
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
1
130
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
Featured
See All Featured
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
410
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
740
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
150
A Soul's Torment
seathinner
5
2.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
Git: the NoSQL Database
bkeepers
PRO
432
66k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.7k
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