SlideShare a Scribd company logo
Dev Environment
How-To
29 Oct. 2013, Django Workshop @ CLBC
Django Dev Environment Howto
Me
•TP (@uranusjr)
• http://uranusjr.logdown.com/pages/about

•RTFD
•Had a crash with Futura recently
The (Most) Comprehensive
Guide to Setting up a
Development Environment
for Django Projects
The (Most) Comprehensive
Guide to Setting up a
Development Environment
for Python Projects
Django
A Web Framework That Does Not Require a Mac
Topics
• Choose your database (carefully)	

• Yes, when you develop	

• Construct a perfect Python dev machine	

• Linux	

• OS X
Topics
• Choose your database (carefully)	

• Yes, when you develop	

• Construct a perfect Python dev machine	

• Linux	

• OS X	

• Windows
Topics
• Choose your database (carefully)	

• Yes, when you develop	

• Construct a perfect Python dev machine	

• Other things
Database
Just use PostgreSQL
Why?
• Free as in Freedom	

• Recommended by dentists core developers	

• Data migration
Why?
• Free as in Freedom	

• Recommended by core developers	

• Data migration
Matching Engines

• Different engines behave differently	

• Fixtures are not for data migration
Engine Behaviour
• A true story	

• Handling long strings	

• Type safety (if you use something raw)	

• Bugs on production machine are hard to find
Data Migration
• Fixtures do not represent your data completely	

• They are just JSON, after all	

• You can't rollback loaddata	

• ContentTypes
SQLite Is (Still) Useful
• Easy to wipe everything and start over	

• Quick 'n' dirty tests	

• Early stages during development
But...
• MySQL is okay	

• Even Oracle is okay if you don't care	

• MariaDB	

• Just use it
Python Packages
What Version of
Python Should I Use?
Python
• Anything over 2.7.0 should be enough	

• YUM is still based on 2.6... Oops.	

• Python 3 is coming…or not	

• Having both Python 2 and 3 installed on Windows
can be a nightmare
Setuptools and PIP
• https://bitbucket.org/pypa/setuptools/raw/
bootstrap/ez_setup.py	

• python ez_setup.py	

• Modify PATH environment variable if needed	

• easy_install pip
Virtualenv
• pip install virtualenv	

• virtualenvwrapper	

• pip install virtualenvwrapper	

• pip install virtualenvwrapper-win	

• pip install virtualenvwrapper-powershell
WUT?
• setuptools = Python's package manager	

• Ever heard of distribute?	

• pip = Better easy_install alternative	

• virtualenv = Prevent Python lib pollution	

• virtualenvwrapper = Better virtualenv UI	

• Windows variants	

• Didi I hear somebody say APT?
virtualenvwrapper
• WORKON_HOME	

• Load the commands (if needed)	

• Commands	

• mkvirtualenv	

• workon	

• Read the docs
Django and Friends
• Always install packages inside virtualenv with pip	

• pip install django	

• pip install -r <requirement_file>	

• pip freeze
This is not enough.
Python Has Limits
• Database connector	

• Image processing	

• Other heavy-lifting tasks
PostgreSQL Libs (in C)
• OS X	

• Installer or Homebrew	

• Linux	

• Your favourite package manager	

• Windows	

• Installer
pip install psycopg2
Django Dev Environment Howto
Django Dev Environment Howto
Django Dev Environment Howto
Build a C Extension
• Get a C compiler	

• Install (or compile) library to bind with	

• Install CPython headers	

• apt-get install python-dev	

• pip install <binding_package>
Build a C Extension
• Get THE ONE TRUE C compiler	

• Install (or compile) library to bind with	

• Install CPython headers	

• apt-get install python-dev	

• pip install <binding_package>
Get a Compiler
• apt-get install build-essential	

• OK, I got lazy :p	

• Install Xcode and its "console tools"	

• Install Visual Studio (Express)	

• The "for Windows Desktop" version	

• Use the correct prompt
Django Dev Environment Howto
Until Python 3.2

VS90COMNTOOLS	

!

VS100COMNTOOLS
Python 3.3
VS90COMNTOOLS
Visual Studio 2008
VS100COMNTOOLS
Visual Studio 2010
If you have VS2012 and Python 2.7, for example
set VS90COMNTOOLS=%VS110COMNTOOLS%
Django Dev Environment Howto
Django Dev Environment Howto
I No Want C Compiler!

• Pre-compiled binaries from the package manager	

• Pre-compiled binaries from the Web
Words of Warning
• Version mismatch	

• CPU Architecture mismatch (Windows sucks)	

• Security issue	

• Why pip doesn't offer binary installing
From APT
• apt-get install python-psycopg2	

• What does it install?	

• http://packages.debian.org	

• .deb file is merely an ar archive	

• ln -s everything into $ENV/lib/site-packages
Pre-Built Installer
• http://www.lfd.uci.edu/~gohlke/pythonlibs/	

• Simply a compressed archive (usually gzip)	

• Viewable with 7-Zip or similar	

• easy_install <installer_path>	

• Use where to make sure
Miscellaneous
• http://rudix.org has pre-built packages for OS X	

• I never used it, to be honest :p	

• RPM packages can be converted with rpm2cpio and
then extracted with cpio	

• Actually you can use MinGW	

• Why?	

• If you really know what you're doing
Questions?

More Related Content

What's hot (20)

PDF
Improve your workflow
Adam Štipák
 
PPTX
TYPO3 CMS deployment with Jenkins CI
derdanne
 
ODP
2015 mindthesec mauro risonho de paula assumpcao rev01 firebits
Mauro Risonho de Paula Assumpcao
 
PDF
Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
mhelmich
 
ODP
5 minute intro to virtualenv
amenasse
 
PPT
Subversion @ JUG Milano 11 dic 2009
Andrea Francia
 
PDF
Pip + virtualenv
Daryl Yu
 
ODP
about Debian "squeeze" @201002 OSC Tokyospring
Hideki Yamane
 
ODP
Jenkins 101: Continuos Integration with Jenkins
All Things Open
 
PPTX
Go & multi platform GUI Trials and Errors
Yoshiki Shibukawa
 
PPTX
Run Python on windows
Sitthykun LY
 
PPTX
Building Open-source React Components
Zack Argyle
 
PPTX
Building Open-Source React Components
Zack Argyle
 
PDF
Does Cowgirl Dream of Red Swirl?
Hideki Yamane
 
PPTX
Fastlane
eurosigdoc acm
 
ODP
Virtualenv
Jon Nials
 
ODP
Buildout: creating and deploying repeatable applications in python
CodeSyntax
 
ODP
It Works On My Machine: Vagrant for Software Development
Carlos Perez
 
PDF
Null Xposed Framework internals and writing modules
Abhinav Chourasia, GMOB
 
PPTX
Continuos Integration @Knetminer
Rothamsted Research, UK
 
Improve your workflow
Adam Štipák
 
TYPO3 CMS deployment with Jenkins CI
derdanne
 
2015 mindthesec mauro risonho de paula assumpcao rev01 firebits
Mauro Risonho de Paula Assumpcao
 
Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
mhelmich
 
5 minute intro to virtualenv
amenasse
 
Subversion @ JUG Milano 11 dic 2009
Andrea Francia
 
Pip + virtualenv
Daryl Yu
 
about Debian "squeeze" @201002 OSC Tokyospring
Hideki Yamane
 
Jenkins 101: Continuos Integration with Jenkins
All Things Open
 
Go & multi platform GUI Trials and Errors
Yoshiki Shibukawa
 
Run Python on windows
Sitthykun LY
 
Building Open-source React Components
Zack Argyle
 
Building Open-Source React Components
Zack Argyle
 
Does Cowgirl Dream of Red Swirl?
Hideki Yamane
 
Fastlane
eurosigdoc acm
 
Virtualenv
Jon Nials
 
Buildout: creating and deploying repeatable applications in python
CodeSyntax
 
It Works On My Machine: Vagrant for Software Development
Carlos Perez
 
Null Xposed Framework internals and writing modules
Abhinav Chourasia, GMOB
 
Continuos Integration @Knetminer
Rothamsted Research, UK
 

Viewers also liked (20)

PDF
We Buy Cheese in a Cheese Shop
Tzu-ping Chung
 
PPTX
Python, Development Environment for Windows
Kwangyoun Jung
 
PDF
Python Recipes for django girls seoul
Joeun Park
 
PDF
NoSql Day - Chiusura
WEBdeBS
 
PDF
PythonBrasil[8] closing
Tatiana Al-Chueyr
 
KEY
Overview of Testing Talks at Pycon
Jacqueline Kazil
 
PPT
Digesting jQuery
Mindfire Solutions
 
PDF
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
PDF
The Django Book Chapter 9 - Django Workshop - Taipei.py
Tzu-ping Chung
 
PDF
2 × 3 = 6
Tzu-ping Chung
 
ODP
Authentication & Authorization in ASPdotNet MVC
Mindfire Solutions
 
PDF
NoSql Day - Apertura
WEBdeBS
 
PDF
PyClab.__init__(self)
Tzu-ping Chung
 
PPTX
Super Advanced Python –act1
Ke Wei Louis
 
PDF
The Django Book, Chapter 16: django.contrib
Tzu-ping Chung
 
PDF
EuroDjangoCon 2009 - Ein Rückblick
Markus Zapke-Gründemann
 
ODP
Rabbitmq & Postgresql
Lucio Grenzi
 
PDF
2007 - 应用系统脆弱性概论
Na Lee
 
PPTX
2016 py con2016_lightingtalk_php to python
Jiho Lee
 
PDF
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
We Buy Cheese in a Cheese Shop
Tzu-ping Chung
 
Python, Development Environment for Windows
Kwangyoun Jung
 
Python Recipes for django girls seoul
Joeun Park
 
NoSql Day - Chiusura
WEBdeBS
 
PythonBrasil[8] closing
Tatiana Al-Chueyr
 
Overview of Testing Talks at Pycon
Jacqueline Kazil
 
Digesting jQuery
Mindfire Solutions
 
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
The Django Book Chapter 9 - Django Workshop - Taipei.py
Tzu-ping Chung
 
2 × 3 = 6
Tzu-ping Chung
 
Authentication & Authorization in ASPdotNet MVC
Mindfire Solutions
 
NoSql Day - Apertura
WEBdeBS
 
PyClab.__init__(self)
Tzu-ping Chung
 
Super Advanced Python –act1
Ke Wei Louis
 
The Django Book, Chapter 16: django.contrib
Tzu-ping Chung
 
EuroDjangoCon 2009 - Ein Rückblick
Markus Zapke-Gründemann
 
Rabbitmq & Postgresql
Lucio Grenzi
 
2007 - 应用系统脆弱性概论
Na Lee
 
2016 py con2016_lightingtalk_php to python
Jiho Lee
 
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
Ad

Similar to Django Dev Environment Howto (20)

PPTX
Presentation of Python, Django, DockerStack
David Sanchez
 
PDF
Python Versions and Dependencies Made Easy
Sebastian Witowski
 
PPTX
Introduction to Python Programming in Civil Engineering
Rushikesh Kolhe
 
PDF
PyData Texas 2015 Keynote
Peter Wang
 
PPT
10 11-hart installing pythonsoftware
William Hart
 
PDF
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
dwvisser
 
PDF
Introduction to python
Agung Wahyudi
 
PDF
venv and pip.pdf
JonathanArp3
 
PDF
A first taste of Python and Django
Ellen Cubbin
 
TXT
vvvvReadme
Mitazaki Yan
 
PDF
Python tutorial
Vijay Chaitanya
 
PDF
Virtualenv
WEBdeBS
 
PDF
Pipfile, pipenv, pip… what?!
Ivan Chernoff
 
KEY
Ladypy 01
Calvin Cheng
 
PDF
Django district pip, virtualenv, virtualenv wrapper & more
Jacqueline Kazil
 
PDF
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Codemotion
 
PPTX
E D - Environmental Dependencies in Python
Adam Englander
 
PDF
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
pythoncharmers
 
PDF
Python. Why to learn?
Oleh Korkh
 
PPTX
Introduction to Python Programming
Akhil Kaushik
 
Presentation of Python, Django, DockerStack
David Sanchez
 
Python Versions and Dependencies Made Easy
Sebastian Witowski
 
Introduction to Python Programming in Civil Engineering
Rushikesh Kolhe
 
PyData Texas 2015 Keynote
Peter Wang
 
10 11-hart installing pythonsoftware
William Hart
 
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
dwvisser
 
Introduction to python
Agung Wahyudi
 
venv and pip.pdf
JonathanArp3
 
A first taste of Python and Django
Ellen Cubbin
 
vvvvReadme
Mitazaki Yan
 
Python tutorial
Vijay Chaitanya
 
Virtualenv
WEBdeBS
 
Pipfile, pipenv, pip… what?!
Ivan Chernoff
 
Ladypy 01
Calvin Cheng
 
Django district pip, virtualenv, virtualenv wrapper & more
Jacqueline Kazil
 
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Codemotion
 
E D - Environmental Dependencies in Python
Adam Englander
 
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
pythoncharmers
 
Python. Why to learn?
Oleh Korkh
 
Introduction to Python Programming
Akhil Kaushik
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Python basic programing language for automation
DanialHabibi2
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 

Django Dev Environment Howto