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

PDF
Turbo boosting your python development
PPTX
AVA - a futuristic test runner
PDF
Making Py Pi Sux Less Key
PDF
Puppet Camp New York 2015: "Safer Puppet" in 4 quick demos (Beginner)
PPTX
uWSGI - Swiss army knife for your Python web apps
PDF
Continuous Integration
PDF
Atom Text Editor: Resistance is Futile
PDF
Testing your infallibleness
Turbo boosting your python development
AVA - a futuristic test runner
Making Py Pi Sux Less Key
Puppet Camp New York 2015: "Safer Puppet" in 4 quick demos (Beginner)
uWSGI - Swiss army knife for your Python web apps
Continuous Integration
Atom Text Editor: Resistance is Futile
Testing your infallibleness

What's hot (20)

PDF
Improve your workflow
PPTX
TYPO3 CMS deployment with Jenkins CI
ODP
2015 mindthesec mauro risonho de paula assumpcao rev01 firebits
PDF
Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
ODP
5 minute intro to virtualenv
PPT
Subversion @ JUG Milano 11 dic 2009
PDF
Pip + virtualenv
ODP
about Debian "squeeze" @201002 OSC Tokyospring
ODP
Jenkins 101: Continuos Integration with Jenkins
PPTX
Go & multi platform GUI Trials and Errors
PPTX
Run Python on windows
PPTX
Building Open-source React Components
PPTX
Building Open-Source React Components
PDF
Does Cowgirl Dream of Red Swirl?
PPTX
Fastlane
ODP
Virtualenv
ODP
Buildout: creating and deploying repeatable applications in python
ODP
It Works On My Machine: Vagrant for Software Development
PDF
Null Xposed Framework internals and writing modules
PPTX
Continuos Integration @Knetminer
Improve your workflow
TYPO3 CMS deployment with Jenkins CI
2015 mindthesec mauro risonho de paula assumpcao rev01 firebits
Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
5 minute intro to virtualenv
Subversion @ JUG Milano 11 dic 2009
Pip + virtualenv
about Debian "squeeze" @201002 OSC Tokyospring
Jenkins 101: Continuos Integration with Jenkins
Go & multi platform GUI Trials and Errors
Run Python on windows
Building Open-source React Components
Building Open-Source React Components
Does Cowgirl Dream of Red Swirl?
Fastlane
Virtualenv
Buildout: creating and deploying repeatable applications in python
It Works On My Machine: Vagrant for Software Development
Null Xposed Framework internals and writing modules
Continuos Integration @Knetminer
Ad

Viewers also liked (20)

PDF
We Buy Cheese in a Cheese Shop
PPTX
Python, Development Environment for Windows
PDF
Python Recipes for django girls seoul
PDF
NoSql Day - Chiusura
PDF
PythonBrasil[8] closing
KEY
Overview of Testing Talks at Pycon
PPT
Digesting jQuery
PDF
Django - The Web framework for perfectionists with deadlines
PDF
The Django Book Chapter 9 - Django Workshop - Taipei.py
PDF
2 × 3 = 6
ODP
Authentication & Authorization in ASPdotNet MVC
PDF
NoSql Day - Apertura
PDF
PyClab.__init__(self)
PPTX
Super Advanced Python –act1
PDF
The Django Book, Chapter 16: django.contrib
PDF
EuroDjangoCon 2009 - Ein Rückblick
ODP
Rabbitmq & Postgresql
PDF
2007 - 应用系统脆弱性概论
PPTX
2016 py con2016_lightingtalk_php to python
PDF
Django - The Web framework for perfectionists with deadlines
We Buy Cheese in a Cheese Shop
Python, Development Environment for Windows
Python Recipes for django girls seoul
NoSql Day - Chiusura
PythonBrasil[8] closing
Overview of Testing Talks at Pycon
Digesting jQuery
Django - The Web framework for perfectionists with deadlines
The Django Book Chapter 9 - Django Workshop - Taipei.py
2 × 3 = 6
Authentication & Authorization in ASPdotNet MVC
NoSql Day - Apertura
PyClab.__init__(self)
Super Advanced Python –act1
The Django Book, Chapter 16: django.contrib
EuroDjangoCon 2009 - Ein Rückblick
Rabbitmq & Postgresql
2007 - 应用系统脆弱性概论
2016 py con2016_lightingtalk_php to python
Django - The Web framework for perfectionists with deadlines
Ad

Similar to Django Dev Environment Howto (20)

PPTX
Presentation of Python, Django, DockerStack
PDF
Python Versions and Dependencies Made Easy
PPTX
Introduction to Python Programming in Civil Engineering
PDF
PyData Texas 2015 Keynote
PPT
10 11-hart installing pythonsoftware
PDF
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
PDF
Introduction to python
PDF
venv and pip.pdf
PDF
A first taste of Python and Django
TXT
vvvvReadme
PDF
Python tutorial
PDF
Virtualenv
PDF
Pipfile, pipenv, pip… what?!
KEY
Ladypy 01
PDF
Django district pip, virtualenv, virtualenv wrapper & more
PDF
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
PPTX
E D - Environmental Dependencies in Python
PDF
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
PDF
Python. Why to learn?
PPTX
Introduction to Python Programming
Presentation of Python, Django, DockerStack
Python Versions and Dependencies Made Easy
Introduction to Python Programming in Civil Engineering
PyData Texas 2015 Keynote
10 11-hart installing pythonsoftware
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
Introduction to python
venv and pip.pdf
A first taste of Python and Django
vvvvReadme
Python tutorial
Virtualenv
Pipfile, pipenv, pip… what?!
Ladypy 01
Django district pip, virtualenv, virtualenv wrapper & more
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
E D - Environmental Dependencies in Python
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python. Why to learn?
Introduction to Python Programming

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Electronic commerce courselecture one. Pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
KodekX | Application Modernization Development
MYSQL Presentation for SQL database connectivity
The AUB Centre for AI in Media Proposal.docx
Building Integrated photovoltaic BIPV_UPV.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Electronic commerce courselecture one. Pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Encapsulation_ Review paper, used for researhc scholars
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
sap open course for s4hana steps from ECC to s4
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Diabetes mellitus diagnosis method based random forest with bat algorithm
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Spectral efficient network and resource selection model in 5G networks
KodekX | Application Modernization Development

Django Dev Environment Howto