Django Development Demystified Pt1

Title: Django development demystified - Part 1 Date: 2012-02-10 11:45 Author: eamonnfaherty Category: development Slug: django-development-demystified-pt1

Django is an amazing development framework for those who want to separate concerns (write good, clean code) and want to get the job done - quickly!

It is written in Python and requires you to write Python code to use it.  Python differs from PHP.  PHP comes with most of the libraries you need out of the box and then has PEAR and PHAR to supply the rest.  Python is a little more fragmented.  With Python, you have to install the library and then install the python bindings, which is the python code that allows you to communicate with the libraries.  For example, if you want to use mysql you must install mysql and then the mysql python bindings.  This can be confusing and you can end up in a world of dependency nightmare!

With libraries like pip, vagrant and virtualenv and PaaS like dotCloud and Heroku I do not think it is such a pain anymore.  These problems can now be solved once and shared across projects.  For my own development (and sanity) I have put together a bootstrap vagrant file which allows me to build a virtual server.  It using vagrant, which in turn uses VirtualBox, to build a virtual server and then uses Chef to install the recipes (which are individual dependencies).  These recipeies include nginx, postgres etc.  At the end of a couple of commands you end up with a working virtual server because somebody else has saved a working set for you.  Great eh!?!

Here is my git repo.  To use this all you need to do it install git and VirtualBox and then run the following commands in a terminal window:

[code lang=”bash” ]

git clone https://github.com/ineedarobot/geodjango-env

cd geodjango-env

vagrant up

[/code]

Once it is up you can login using vagrant ssh and your server is ready! Any questions please post a comment and I will try to help.  If you spot any issues with my setup feel free to post an issue on the github repo.

BTW, this is actually a working setup for geodjango, meaning it installs Postgres, postgis and the gis libraries needed.

Published: February 10 2012

  • category:
  • tags:
blog comments powered by Disqus