Python, Django, & MySQL on Windows 7, Part 4: Installing Django

This is the fourth post in a  dummies guide to getting stared with Python, Django, & MySQL on Windows 7.

We’re finally ready to install Django, a popular Web-development framework. Detailed instructions for building out a Django site are beyond the scope of this humble tutorial; try The Definitive Guide to Django or Django’s online Getting started docs for that.

These directions will simply make sure you can get up and running.

Installing Django

  1. Open a command window.
  2. Go to (or create) the virtual environment you’ll be using for your django project. For this example, I created a virtualenv called django-tutorial: virtualenv django-tutorial --no-site-packages
  3. Install django: pip install django
    install django 
  4. Start an interactive interpreter by typing python (or iPython, if you’ve made it virtual environment-aware).
  5. Test the install by importing the django module and checking its version: https://gist.github.com/1177372
  6. Create a new directory to hold your Django projects and code. Change to it.
  7. Think of a name for your first Django project and create it by running the following command: python -m django-admin startproject [projectname].
    Important: most Django docs show django-admin.py startproject [projectname] to start a new project, which can cause import errors and other trouble for Windows users. See this stackoverflow thread for details.
  8. You should now see the project’s folder in your Django directory:django project folder
  9. Change into the new project folder.
  10. Test the new project by typing python manage.py.  Manage.py is Django’s command line utility; you should see a list of its available subcommands.
  11. A further test is to start up Django’s development server: python manage.py runserver. You should see something like this:
    django runserver

If you’ve made it this far, you’ve successfully installed Django and created your first project.

Next up is Part 5: Installing MySQL.

, , ,

Trackbacks/Pingbacks

  1. Python, Django, & MySQL on Windows 7, Part 1: Getting Started | Computers are for People - September 14, 2011

    [...] Part 4: installing Django [...]

  2. Python, Django, & MySQL on Windows 7, Part 2: Virtual Environments | Computers are for People - September 14, 2011

    [...] Part 4: installing Django [...]

  3. Python, Django, & MySQL on Windows 7, Part 3: iPython & Virtual Environments | Computers are for People - September 14, 2011

    [...] Part 4: installing Django [...]

  4. Python, Django, MySQL & Win 7 | Computers are for People - September 15, 2011

    [...] Part 4: installing Django [...]

  5. Python, Django, & MySQL on Windows 7, Part 5: Installing MySQL | Computers are for People - January 16, 2012

    [...] Part 4: installing Django [...]

Leave a Reply