Heya, Thanks for visiting!
edited

This is a basic guide to get django running with WAMP. This tutorial was written with Python 2.7.5 and django 1.5 in mind but applies for all versions.

Use Windows command prompt (cmd) whenever it says to use a command. I suggest using this command prompt alternative.

Basic Setup:

  • Install WAMP
  • Get mod_wsgi module for apache. I suggest getting it from here. Add mod_wsgi.so to C:\wamp-2-4.64bit\bin\apache\Apache2.4.4\modules
  • Add the line in httpd.conf: LoadModule wsgi_module modules/mod_wsgi-ap24-py27.so
  • Install Python 2.7.5 because Python 3.3 does not have enough supported packages
  • Install virtualenv (python package) using this command: pip install virtualenv
  • Create a folder called www-src alongside your wamp www folder and navigate to it in cmd using this command: cd C:\wamp-2-4.64bit\www-src
  • Create a new environment called venv using this command: virtualenv venv
  • Navigate to C:\wamp-2-4.64bit\www-src\venv\Scripts and run the command activate to get your virtualenv running. You will notice (venv) in cmd.
  • Install django in your virtualenv from the website or use this command: pip install Django
  • Make a new django project using this command: python django-admin.py startproject mysite
  • Add the python home to the bottom of apaches's httpd.conf and point to your virtualenv: WSGIPythonHome "C:/wamp-2-4.64bit/www-src/venv"
  • Connect it to WAMP by adding this to apaches's httpd.conf:
WSGIScriptAlias /django-project "C:/wamp-2-4.64bit/www-src/django_project/django_project/wsgi.py"
WSGIPythonPath "C:/wamp-2-4.64bit/www-src/django_project/"

<Directory "C:/wamp-2-4.64bit/www-src/django_project/django_project/">
    <Files wsgi.py>
        Order deny,allow
        Require all granted
    </Files>
</Directory>
  • Put the following code at the top of settings.py:
import os
BASE_DIR = os.path.realpath(os.path.dirname(__file__))
  • In your django project settings.py set up static file stuff:
STATIC_ROOT = 'C:/wamp-2-4.64bit/www/static'
STATIC_URL = 'http://localhost/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)
  • Serve your static files. Add this to apache's httpd.conf:
Alias /static C:/wamp-2-4.64bit/www/static

<Directory "C:/wamp-2-4.64bit/www/static">
    Order deny,allow
    Allow from all
    Require all granted
</Directory>

Common Commands:

manage.py is in the base of your django projects directory
django-admin.py should be on your system path. Problems? See this documentation

Command Description
python manage.py collectstatic Gets all new or edited static files and puts it in the STATIC_ROOT to be served
python manage.py syncdb Update the db structure to reflect your models
python django-admin.py startproject mysite Start a django project to host your django apps
python manage.py startapp polls Start a django app in your django project
python manage.py changepassword *username* Change the password of the specified user. (Optionally, you can visit: example.com/path-to-admin/password_change/ if you have the admin enabled)

Best Practices: