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
Confident Asset Deployments with Webpack & Django
Search
Scott Burns
July 19, 2016
Technology
0
1.2k
Confident Asset Deployments with Webpack & Django
Presented at Djangocon US 2016 on Tuesday, July 19th 2016.
Scott Burns
July 19, 2016
Tweet
Share
More Decks by Scott Burns
See All by Scott Burns
Learning From the Pros: Modern Data Management for Clinicians and Scientists
sburns
1
35
An Introduction to Channels
sburns
0
230
Empathy-as-a-Service
sburns
0
91
Improving Research With Advanced REDCap Interfaces
sburns
1
610
ROSIE: Automated Image Processing Infrastructure
sburns
0
140
Other Decks in Technology
See All in Technology
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
110
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
200
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
210
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
170
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
210
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
120
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
20241220_S3 tablesの使い方を検証してみた
handy
4
630
UI State設計とテスト方針
rmakiyama
2
650
サーバーなしでWordPress運用、できますよ。
sogaoh
PRO
0
110
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Bash Introduction
62gerente
608
210k
Thoughts on Productivity
jonyablonski
67
4.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Building an army of robots
kneath
302
44k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Music & Morning Musume
bryan
46
6.2k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Transcript
CONFIDENT ASSET DEPLOYMENTS WITH WEBPACK & DJANGO SCOTT BURNS (@SCOTTSBURNS)
DJANGOCON US 2016 #CONFIDENT-DEPLOYS
SHHH, I HAVE A SECRET @scottsburns Confident Asset Deployments
OWAIS LONE GITHUB.COM/OWAIS
̣ PHILOSOPHY ̣ SPECIFICS ̣ PHILOSOPHY @scottsburns Confident Asset Deployments
CONFIDENT ASSET DEPLOYMENTS? @scottsburns Confident Asset Deployments
DEPLOYMENTS Confident Asset Deployments @scottsburns
̣CHANGES ̣FEATURES ̣FIXES Confident Asset Deployments @scottsburns
ASSET @scottsburns Confident Asset Deployments
̣JAVASCRIPT ̣CSS ̣IMAGES @scottsburns Confident Asset Deployments
CONFIDENT @scottsburns Confident Asset Deployments
̣EASY TO BEGIN ̣REVERSIBLE ̣FAST @scottsburns Confident Asset Deployments
̣AUTOMATED ̣FEW 3RD PARTIES ̣TESTED @scottsburns Confident Asset Deployments
WHY NOW? Confident Asset Deployments @scottsburns
TOOLCHAINS HAVE IMPROVED Confident Asset Deployments @scottsburns
COMMUNITIES MOVE AT DIFFERENT SPEEDS Confident Asset Deployments @scottsburns
BUILD BRIDGES, NOT WRAPPERS Confident Asset Deployments @scottsburns
CODE PLEASE Confident Asset Deployments @scottsburns
WEBPACK? Confident Asset Deployments @scottsburns
Confident Asset Deployments @scottsburns https://webpack.github.io/ WEBPACK
$ npm install -s -g \ webpack \ webpack-bundle-tracker Confident
Asset Deployments @scottsburns INSTALLATION
WEBPACK.CONFIG.JS Confident Asset Deployments @scottsburns var path = require("path") var
webpack = require('webpack') var BundleTracker = require('webpack-bundle-tracker') module.exports = { entry: { app: ’./static/index.js’ }, output: { path: path.resolve('./static/bundles/'), filename: "[name]-[hash].js", },...
WEBPACK.CONFIG.JS Confident Asset Deployments @scottsburns ... plugins: [ new BundleTracker(
{filename: ‘./webpack-stats.json’}), ], module: { loaders: […] // not enough time :( }, }
$ webpack —-config \ webpack.config.js Confident Asset Deployments @scottsburns BUILD
THE BUNDLE
{ “status":"done", “chunks”: { “app”: [{ “name": "app-1234567890.js", “path”: “/app/static/bundles/
app-1234567890.js”} ] } } Confident Asset Deployments @scottsburns WEBPACK-STATS.JSON
Confident Asset Deployments @scottsburns
app/ ├─ manage.py ├─ webpack.config.js ├─ webpack-stats.json ├─ static │
├─ index.js │ └─ bundles/ # git ignore │ └─ app-1234567890.js └─ app/ └─ urls.py, app.wsgi, etc… Confident Asset Deployments @scottsburns STRUCTURE
<head> ... </head> <body> <div id="root">...</div> <script src=“{% static ‘bundles/app-1234567890.js’
%}” type=“text/javascript” charset=“utf-8”> </body> Confident Asset Deployments @scottsburns INDEX.HTML
$ pip install \ django-webpack-loader Confident Asset Deployments @scottsburns
... STATICFILES_DIRS = ( ‘static’, ) ... Confident Asset Deployments
@scottsburns SETTINGS.PY
... WEBPACK_LOADER = { 'BUNDLE_DIR_NAME': 'bundles/', ‘STATS_FILE': 'webpack-stats.json', } ...
Confident Asset Deployments @scottsburns SETTINGS.PY
... INSTALLED_APPS = ( ... ‘webpack_loader', ... ) ... Confident
Asset Deployments @scottsburns SETTINGS.PY
{% load render_bundle from webpack_loader %} <head> ... </head> <body>
<div id="root">...</div> {% render_bundle ‘main' %} </body> Confident Asset Deployments @scottsburns INDEX.HTML
<head> ... </head> <body> <div id="root">...</div> <script src="/static/bundles/app-1234567890.js" type="text/javascript" charset=“utf-8">
</body> Confident Asset Deployments @scottsburns (RENDERED) INDEX.HTML
Confident Asset Deployments WEBPACK-STATS.JSON INDEX.HTML APP-1234567890.JS @scottsburns
Confident Asset Deployments WEBPACK-STATS.JSON INDEX.HTML APP-0987654321.JS @scottsburns
DON’T SERVE ASSETS FROM DJANGO Confident Asset Deployments @scottsburns
WHY NOT (PURE) STATICFILES? Confident Asset Deployments @scottsburns
̣PRODUCTION ENV ̣SLOW ̣POST-PROCESSORS @scottsburns Confident Asset Deployments
SEPARATE THE CONCERNS Confident Asset Deployments @scottsburns
FRONT-END DEVS WILL ❤ YOU Confident Asset Deployments @scottsburns
(DEV)OPS WILL ❤ YOU Confident Asset Deployments @scottsburns
NEW DEVS WILL ❤ YOU Confident Asset Deployments @scottsburns
̣BUILD ̣DEPLOY ̣REPEAT @scottsburns Confident Asset Deployments
THANK YOU ❤ @scottsburns Confident Asset Deployments