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
540
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
440
Decentralization & real-time with PubSubHubbub
brutasse
1
150
Deployability of Python Web Applications
brutasse
17
2.3k
Stop writing settings files
brutasse
21
2.5k
Class-based Views: patterns and anti-patterns
brutasse
9
1.6k
Packager son projet Django
brutasse
4
550
Introduction to Django
brutasse
3
410
Other Decks in Programming
See All in Programming
Enterprise Web App. Development (1): Build Tool Training Ver. 5
knakagawa
1
120
Strategic Design (DDD)for the Frontend @DDD Meetup Stuttgart
manfredsteyer
PRO
0
160
PHPで書いたAPIをGoに書き換えてみた 〜パフォーマンス改善の可能性を探る実験レポート〜
koguuum
0
170
Vibe Coding の話をしよう
schroneko
10
2.6k
AI Agents with JavaScript
slobodan
0
250
監視 やばい
syossan27
11
9.8k
Thank you <💅>, What's the Next?
ahoxa
1
490
大LLM時代にこの先生きのこるには-ITエンジニア編
fumiyakume
7
3.1k
サービスレベルを管理してアジャイルを加速しよう!! / slm-accelerate-agility
tomoyakitaura
1
190
地域ITコミュニティの活性化とAWSに移行してみた話
yuukis
0
240
AI時代の開発者評価について
ayumuu
0
170
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
300
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
52
11k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.6k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Done Done
chrislema
183
16k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Into the Great Unknown - MozCon
thekraken
37
1.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
19
1.1k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.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