Monday, 25 October 2010

Set up virtualenv and start a django project

This has been a headacke for me. At last I figured out that the best practice is to set up projcets through a virtualenv. So let's first install it

easy_install virtualenv


Afterwards, you must decide where you want to store your virtual environments, Then, we will create our actual new virtual environment.

mkdir ~/djenv
virtualenv ~/djenv/env1

Then you need to activate the environment:

source ~/djenv/env1/bin/activate

You should see '(env1)' comes at the left of the terminal.

So now you can install Django in this environment:

pip install Django


Set up django project wherever you like, e.g.:

mkdir -p ~/sites
cd ~/sites
django-admin.py startproject proj1


To get out of the environment:

deactivate env1


That's it. enjoy!

For mor info...

No comments:

Post a Comment