Computersnyou

How to setup Django with virtualenv in MacOSX Mavericks

Posted on  2/4/2014

In this tutorial I will show you how to install django web framework on MacOSX with virtualenv wrapper . for those who don’t know what is django is , well django is web framework based on MVC architecture written in python.

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

django website have very good documentation on installation process , if you want to install system wide then take a look at that .
anyway let’s start our installation with virtualenv wrapper

what you should know ,

1 just little terminal fu
2 thats all

steps

open your terminal ( from utilities or search in spotlight )

sudo easy_install virtualenv

that will install virtualenv system wide ,
or even better

sudo pip install  virtualenv

okay now , virtualenv is installed lets create our project folder

mkdir my_project

now change directory

cd my_project

Now lets initialize virtualenv , it will copy python executable and setup tools etc to your project folder

Screen Shot 2014-02-04 at 11.17.33 am
Screen Shot 2014-02-04 at 11.17.33 am
virtualenv venv

okay , Now lets activate virtualenv

. venv/bin/activate

Now finally lets install djnago

pip install django

after installation

python -c "import django; print(django.get_version())"

you will see installed django version .
something like ..

Screen Shot 2014-02-04 at 11.27.16 am
Screen Shot 2014-02-04 at 11.27.16 am

okay now django installed and ready to use , okay lets create a sample site

django-admin.py startproject mysite

now change directory to my site

cd mysite
python manage.py runserver

Screen Shot 2014-02-04 at 11.29.27 am
Screen Shot 2014-02-04 at 11.29.27 am

open browser and point to http://localhost:8000 , you will see default django welcome page

Screen Shot 2014-02-04 at 11.29.38 am
Screen Shot 2014-02-04 at 11.29.38 am

leave your comments or start a discussion over forum
I hope it was affirmative for you , thank you


  • Home
  • About