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
Packager son projet Django
Search
Bruno Renié
April 14, 2012
Programming
4
550
Packager son projet Django
Bruno Renié
April 14, 2012
Tweet
Share
More Decks by Bruno Renié
See All by Bruno Renié
Visibility for web developers
brutasse
3
430
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
Staticfiles : tout ce qu'il faut savoir, rien que ce qu'il faut savoir
brutasse
4
540
Introduction to Django
brutasse
3
400
Other Decks in Programming
See All in Programming
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
C++でシェーダを書く
fadis
6
4.1k
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Arm移行タイムアタック
qnighy
0
310
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
役立つログに取り組もう
irof
28
9.6k
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
距離関数を極める! / SESSIONS 2024
gam0022
0
280
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Unsuck your backbone
ammeep
668
57k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Fireside Chat
paigeccino
34
3k
Typedesign – Prime Four
hannesfritz
40
2.4k
Ruby is Unlike a Banana
tanoku
97
11k
Transcript
Bruno Renié Djangocong 2012 Packager son projet Django
distribuer / déployer du code
git
dépendances rollback traçabilité
PaaS
contraintes géographiques architecturales culturelles
packaging
installer son application comme une simple bibliothèque* * configuration laissée
au soin de l'utilisateur
simplicité traçabilité reproductibilité
OS Application deb / RPM setup.py
None
django nettoyez-moi tout ça
arrêter d'altérer sys.path project/ __init__.py urls.py app1/ __init__.py models.py app2/
from project.app1.views import stuff
Application réutilisable : package séparé from project.app.models import Stuff from
registration.models import RegistrationProfile Application non réutilisable : embarquée
requirements : versions explicites Django==1.4 PIL==1.1.6 pas de liens git
setup.py from distutils.core import setup from setuptools import find_packages with
open('requirements.txt') as reqs: install_requires = reqs.read().split('\n') setup( name='project', version=__import__('project').__version__, packages=find_packages(), include_package_data=True, zip_safe=False, install_requires=install_requires, )
MANIFEST.in pour tout ce qui est non-python include requirements.txt recursive‐include
project * recursive‐exclude project *.pyc recursive‐exclude project *.scss exclude project/settings.py
settings project/default_settings.py Packagé : Déployé : settings.py from project.default_settings import
* DATABASES = { … }
layout final requirements.txt setup.py MANIFEST.in project/ __init__.py default_settings.py settings.py app1/
app2/
Déploiement
env/ public/ static/ settings.py wsgi.py ./env/bin/gunicorn wsgi:application utiliser add2virtualenv pour
rendre wsgi et settings importables sans toucher PYTHONPATH
pip et paquets privés --find-links : file:///path/to/packages --index-url : structure
de type http://pypi.python.org/simple/ bien héberger tous ses paquets pypi tombe, les versions disparaissent
Workflow final Déployer (incrément n° de version) python setup.py sdist
(upload) pip install ‐U project ‐‐find‐links … Rollback pip install project==X.Y.Z ‐‐find‐links …
https://github.com/brutasse/fab-bundle @brutasse
[email protected]