Using Django using VirtualEnv on MAC. Fast forward installation.

This is a fast forward tutorial which will guide you through django installation on virtualenv. Detailed installation instructions using source codes can be found on respective package’s official site.

Pre- Requirements:
Make sure you have easy_install on MAC
Install pip using easy_install pip

1) Installing Virtualenv: Run following lines in terminal:

[code lang=”bash” gutter=”false”]
pip install virtualenv
pip install virtualenvwrapper

# Use a text editor to edit .profile and Insert following lines. Eg using vim:
# $ vim .profile
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/

# Now open a new terminal window and Type:
mkvirtualenv myfirstproject

# You will see something like:
(myfirstproject) $

# This means you are now working isolatedly in myfirstproject
# The location of this project is ~/.virtualenvs/myfirstproject

2) Installing Django and South:

[code lang=”bash” gutter=”false”]

# [info] Make sure you are inside myfirstproject:
# $ workon myfirstproject
# Now run in terminal:

pip install Django
pip install south

# This installs Django in: .virtualenvs/myfirstproject/lib/python2.6/site-packages/django/


3) Starting first django project:

  • [info] Type workon myfirstproject if you are not already in your virtual environment.
  • [info] you can directly go to your site packages dir by typing cdsitepackages
  • [info] can check the location of django-admin by which
  • Initiating django project now. Assuming you are at .virtualenvs/myfirstproject/ Type:
  • startproject mydjangoproject
  • This will start your first django project.
  • Now start server by
  • python runserver Default port is 8000. If you have to change port, just write port number after runserver
  • Now, Visit browser at localhost:8000
  • Congrats, we have just installed a basic django app.

Leave a Reply

Your email address will not be published.