SlideShare a Scribd company logo
1 of 18
Download to read offline
Django & Buildout
                                           Horst Gutmann
                                        zerok@zerokspot.com




http://creativecommons.org/licenses/by-nc-sa/3.0/at/   Photo: http://flickr.com/photos/yakobusan/2363688612/
Django
• Web Framework in Python
• MVC
• ... has tons of great features that are
  actually not really relevant for the topic at
  hand
• Summary: <3
                       2
Django and its libs
• What do we usually need ...
 • Django
 • django-tagging
 • django-threadedcomments
 • (if things like DB-bindings are already
    installed)

                      3
All of that you have to
      install on ...
•   ... your own machine
•   ... your server

•   ... and basically every other machine that has
    anything to do with the development




                        4
Installing from & with ...

•   Straight from an SCM-checkout

    •   Sadly that’s still very common since the apps
        are still quite young

•   Using a setup.py

•   Using setuptools and easy_install (PyPI <3)



                           5
Being root helps

• You have to either install these libraries as
  root user
• ... or you have to start messing around with
  the PYTHONPATH
  • ... which normally results in just a big
    mess


                       6
virtualenv

      • virtualenv lets you                       $ virtualenv myenv
          install Python packages
          without being root                      $ source myenv/bin/activate


      • It lets you build
                                                  $ cd /some/lib

                                                  $ python setup.py install
          environments for those
                                                  ....
          packages that you load
          at will                                 $ deactivate




Photo: http://flickr.com/photos/fensterbme/145621388/
                                           7
virtualenv
•   ... is a great tool if you want to try a new
    library

•   But it doesn’t solve the problem that you have
    to manually reconstruct the environment
    every time.

•   The environments are not portable (C-
    extensions?)

•   ... and not moveable (experimental right now)

                          8
zc.buildout
         •   Buildout now lets you build a whole
             environment with just one config-file

         •   Basically, it’s similar to Maven in the Java-world,
             just without XML ;-)

         •   A project consists of multiple parts

         •   Each part defines, where its data is coming from
             and where to store it


Photo: http://flickr.com/photos/mdpettitt/2521514631/
                                           9
Recipes exist ...
• ... that download eggs and build a wrapped
  interpreter to test them
• ... that download a source-distribution and
  install it
• ... that checkout code from Subversion
• ... and much much more
                      10
A small example
                                   $ buildout
>>> buildout.cfg                       PyPI           Canonical




[buildout]
parts = sample

[sample]
recipe = zc.recipe.eggs
interpreter = myinterpreter
eggs =
    storm==0.12
                                   $./bin/myinterpreter
                                   > from storm.locals import *



                              11
Buildout for Django

•   What is in for Django developers?

    •   A simple way to install dependencies

    •   ... and to freeze them at a version

    •   ... and naturally really fast deployment (even
        with a WSGI-script)



                           12
djangorecipe
• Recipe for Django projects by Jeroen
  Vloothuis:
  http://pypi.python.org/pypi/djangorecipe/
• Creates a Django project with a   given
  version
• ... and creates a wrapper for manage.py
  with all eggs and other dependencies
  loaded

                     13
Another example
[buildout]
parts = django svnapps

[django]
recipe = djangorecipe
version = 1.0
project = mysite
settings = settings
extra-paths =
    ${svnapps:location}/tagging

[svnapps]
recipe = iw.recipe.subversion
urls =
    http://django-tagging.googlecode.com/svn/trunk/ tagging



                            14
./bin/django
import sys
sys.path[0:0] = [
  '$HOME/.buildout/eggs/djangorecipe-0.12.1-py2.6.egg',
  '$HOME/.buildout/eggs/zc.recipe.egg-1.1.0-py2.6.egg',
  '$HOME/.buildout/eggs/zc.buildout-1.1.1-py2.6.egg',
  '$HOME/.buildout/eggs/setuptools-0.6c9-py2.6.egg',
  '$HOME/tmp/buildout2/parts/django',
  '$HOME/tmp/buildout2',
  '$HOME/tmp/buildout2/parts/svnapps/tagging',
  ]

import djangorecipe.manage
if __name__ == '__main__':
   djangorecipe.manage.main('mysite.settings')



                           15
mod_wsgi?

• djangorecipe can also be used to create a
  WSGI-script
  • Option: wsgi = true
  • ./bin/django.wsgi
• Naturally also includes all the dependencies

                     16
Summary
•   Buildout provides easy dependency management
    from a multitude of sources (public or not and not
    only with setuptools)

•   Dependencies AND freezing of them

•   For developing on a Django project all you need is
    one buildout.cfg

•   djangorecipe also provides you with a WSGI-script

•   Migrating to it is very easy :-)

                            17
Some links

• http://www.djangoproject.com
• http://pypi.python.org/pypi/zc.buildout/
• http://pypi.python.org/pypi/djangorecipe/
• Icons: http://graffletopia.com/stencils/144
• Pony: http://djangopony.com
                      18

More Related Content

What's hot

Native Containers on Windows 10 using Docker – a game changer for developers
Native Containers on Windows 10 using Docker – a game changer for developersNative Containers on Windows 10 using Docker – a game changer for developers
Native Containers on Windows 10 using Docker – a game changer for developers
Jorge Arteiro
 

What's hot (20)

An intro to the JAMStack and Eleventy
An intro to the JAMStack and EleventyAn intro to the JAMStack and Eleventy
An intro to the JAMStack and Eleventy
 
Grunt: the wild boar dev's best friend - WordCamp London 2018
Grunt: the wild boar dev's best friend - WordCamp London 2018Grunt: the wild boar dev's best friend - WordCamp London 2018
Grunt: the wild boar dev's best friend - WordCamp London 2018
 
Grooscript gr8conf 2015
Grooscript gr8conf 2015Grooscript gr8conf 2015
Grooscript gr8conf 2015
 
Grooscript greach
Grooscript greachGrooscript greach
Grooscript greach
 
Node js实践
Node js实践Node js实践
Node js实践
 
Adventures in infrastructure as code
Adventures in infrastructure as codeAdventures in infrastructure as code
Adventures in infrastructure as code
 
Terminus, the Pantheon command-line interface
Terminus, the Pantheon command-line interfaceTerminus, the Pantheon command-line interface
Terminus, the Pantheon command-line interface
 
Plone and docker
Plone and dockerPlone and docker
Plone and docker
 
Grooscript and Grails 3
Grooscript and Grails 3Grooscript and Grails 3
Grooscript and Grails 3
 
CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)
 
Webinar - Setup MySQL with Puppet
Webinar - Setup MySQL with PuppetWebinar - Setup MySQL with Puppet
Webinar - Setup MySQL with Puppet
 
Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
Grunt All Day
Grunt All DayGrunt All Day
Grunt All Day
 
Docker Demo @ IuK Seminar
Docker Demo @ IuK SeminarDocker Demo @ IuK Seminar
Docker Demo @ IuK Seminar
 
Sage 2 19_v5_busby
Sage 2 19_v5_busbySage 2 19_v5_busby
Sage 2 19_v5_busby
 
Continuous Integration for front-end JavaScript
Continuous Integration for front-end JavaScriptContinuous Integration for front-end JavaScript
Continuous Integration for front-end JavaScript
 
Docker in Production: Reality, Not Hype
Docker in Production: Reality, Not HypeDocker in Production: Reality, Not Hype
Docker in Production: Reality, Not Hype
 
Native Containers on Windows 10 using Docker – a game changer for developers
Native Containers on Windows 10 using Docker – a game changer for developersNative Containers on Windows 10 using Docker – a game changer for developers
Native Containers on Windows 10 using Docker – a game changer for developers
 
Zenoss: Buildout
Zenoss: BuildoutZenoss: Buildout
Zenoss: Buildout
 
Magento 2 Capistrano Deploy
Magento 2 Capistrano DeployMagento 2 Capistrano Deploy
Magento 2 Capistrano Deploy
 

Similar to Django & Buildout (en)

ネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみた
ネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみたネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみた
ネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみた
furusin
 

Similar to Django & Buildout (en) (20)

Getting started with open mobile development on the Openmoko platform
Getting started with open mobile development on the Openmoko platformGetting started with open mobile development on the Openmoko platform
Getting started with open mobile development on the Openmoko platform
 
Jython on Django
Jython on DjangoJython on Django
Jython on Django
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
 
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
 
Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or Gal
 
Marek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with BuildoutMarek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with Buildout
 
Continuous Integration Step-by-step
Continuous Integration Step-by-stepContinuous Integration Step-by-step
Continuous Integration Step-by-step
 
Django Deployment with Fabric
Django Deployment with FabricDjango Deployment with Fabric
Django Deployment with Fabric
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Towards Continuous Deployment with Django
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with Django
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
Django district pip, virtualenv, virtualenv wrapper & more
Django district  pip, virtualenv, virtualenv wrapper & moreDjango district  pip, virtualenv, virtualenv wrapper & more
Django district pip, virtualenv, virtualenv wrapper & more
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-way
 
Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native edition
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016
 
Vagrant and puppet: Deployment made easy
Vagrant and puppet: Deployment made easyVagrant and puppet: Deployment made easy
Vagrant and puppet: Deployment made easy
 
“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.
 
ネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみた
ネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみたネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみた
ネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみた
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Django & Buildout (en)

  • 1. Django & Buildout Horst Gutmann zerok@zerokspot.com http://creativecommons.org/licenses/by-nc-sa/3.0/at/ Photo: http://flickr.com/photos/yakobusan/2363688612/
  • 2. Django • Web Framework in Python • MVC • ... has tons of great features that are actually not really relevant for the topic at hand • Summary: <3 2
  • 3. Django and its libs • What do we usually need ... • Django • django-tagging • django-threadedcomments • (if things like DB-bindings are already installed) 3
  • 4. All of that you have to install on ... • ... your own machine • ... your server • ... and basically every other machine that has anything to do with the development 4
  • 5. Installing from & with ... • Straight from an SCM-checkout • Sadly that’s still very common since the apps are still quite young • Using a setup.py • Using setuptools and easy_install (PyPI <3) 5
  • 6. Being root helps • You have to either install these libraries as root user • ... or you have to start messing around with the PYTHONPATH • ... which normally results in just a big mess 6
  • 7. virtualenv • virtualenv lets you $ virtualenv myenv install Python packages without being root $ source myenv/bin/activate • It lets you build $ cd /some/lib $ python setup.py install environments for those .... packages that you load at will $ deactivate Photo: http://flickr.com/photos/fensterbme/145621388/ 7
  • 8. virtualenv • ... is a great tool if you want to try a new library • But it doesn’t solve the problem that you have to manually reconstruct the environment every time. • The environments are not portable (C- extensions?) • ... and not moveable (experimental right now) 8
  • 9. zc.buildout • Buildout now lets you build a whole environment with just one config-file • Basically, it’s similar to Maven in the Java-world, just without XML ;-) • A project consists of multiple parts • Each part defines, where its data is coming from and where to store it Photo: http://flickr.com/photos/mdpettitt/2521514631/ 9
  • 10. Recipes exist ... • ... that download eggs and build a wrapped interpreter to test them • ... that download a source-distribution and install it • ... that checkout code from Subversion • ... and much much more 10
  • 11. A small example $ buildout >>> buildout.cfg PyPI Canonical [buildout] parts = sample [sample] recipe = zc.recipe.eggs interpreter = myinterpreter eggs = storm==0.12 $./bin/myinterpreter > from storm.locals import * 11
  • 12. Buildout for Django • What is in for Django developers? • A simple way to install dependencies • ... and to freeze them at a version • ... and naturally really fast deployment (even with a WSGI-script) 12
  • 13. djangorecipe • Recipe for Django projects by Jeroen Vloothuis: http://pypi.python.org/pypi/djangorecipe/ • Creates a Django project with a given version • ... and creates a wrapper for manage.py with all eggs and other dependencies loaded 13
  • 14. Another example [buildout] parts = django svnapps [django] recipe = djangorecipe version = 1.0 project = mysite settings = settings extra-paths = ${svnapps:location}/tagging [svnapps] recipe = iw.recipe.subversion urls = http://django-tagging.googlecode.com/svn/trunk/ tagging 14
  • 15. ./bin/django import sys sys.path[0:0] = [ '$HOME/.buildout/eggs/djangorecipe-0.12.1-py2.6.egg', '$HOME/.buildout/eggs/zc.recipe.egg-1.1.0-py2.6.egg', '$HOME/.buildout/eggs/zc.buildout-1.1.1-py2.6.egg', '$HOME/.buildout/eggs/setuptools-0.6c9-py2.6.egg', '$HOME/tmp/buildout2/parts/django', '$HOME/tmp/buildout2', '$HOME/tmp/buildout2/parts/svnapps/tagging', ] import djangorecipe.manage if __name__ == '__main__': djangorecipe.manage.main('mysite.settings') 15
  • 16. mod_wsgi? • djangorecipe can also be used to create a WSGI-script • Option: wsgi = true • ./bin/django.wsgi • Naturally also includes all the dependencies 16
  • 17. Summary • Buildout provides easy dependency management from a multitude of sources (public or not and not only with setuptools) • Dependencies AND freezing of them • For developing on a Django project all you need is one buildout.cfg • djangorecipe also provides you with a WSGI-script • Migrating to it is very easy :-) 17
  • 18. Some links • http://www.djangoproject.com • http://pypi.python.org/pypi/zc.buildout/ • http://pypi.python.org/pypi/djangorecipe/ • Icons: http://graffletopia.com/stencils/144 • Pony: http://djangopony.com 18