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].
    If that doesn’t work, try python -m django-admin startproject [projectname] (thanks JukkaN!)
    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.

, , ,

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

  1. ivan June 9, 2013 at 5:37 am #

    Great tutorial, I made my django project succesfully following your tutorials but now I would like to know is it possible to use pyscripter to work with custom environment. If so, can you please explain how? I really can’t figure it out.

  2. Brendan October 17, 2015 at 2:33 am #

    Hey, thanks for the tutorial. Unfortunately I’m stuck on the Django install – I followed your instructions exactly but I can’t get the django version number – it errors on me:
    C:\>python
    Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on wi
    n32
    Type “help”, “copyright”, “credits” or “license” for more information.

    >>> import django
    >>> django.version
    Traceback (most recent call last):
    File “”, line 1, in
    AttributeError: ‘module’ object has no attribute ‘version’
    >>>

  3. BestLuisa May 12, 2018 at 5:22 am #

    I see you don’t monetize your blog, don’t waste your traffic, you can earn extra
    bucks every month because you’ve got hi quality content.
    If you want to know how to make extra $$$, search for:
    Ercannou’s essential adsense alternative

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