Pages

Friday, March 30, 2012

Django: A setup tutorial guide from A-Z

Django is one of the most commonly used frameworks for web development today. It can be used in multi functional large scale database driven web application. Though it was created mainly for the means of rapid development of web application, it has well proven on its account for reliability and scalability. So here I am going to share some of my experience during the set up process which many of us find awkward. Hope this simplified version makes it easy for you all.
Download:
                Download Django from www.djangoproject.com(get the latest and fail not to check out          which version of python it supports)
                Download Python- and this should be the one supported by the version which you     downloaded        
Installation:
 >Install python in your  machine 
 >Extract the tar file of Django you have downloaded
 >cd to the the folder you extracted and type the following:
    python setup.py install
    This will install all the required files in
               C:\Python27\Lib\Site-Packages\Django 
Now that Django is installed in your system, You can start creating projects.But before   that lets put the django-admin.py in the path environment variable of the system. 
So go to>MyComputer>Properties>Advanced System Settings>Environment


   Then go to down slab for system path and 
            click Path double times. This will pop up edit window and do the following there:
             >add a semi colon(;) and paste the following:
                                  C:\Python_version\Python.exe;C:\Python_version\Scripts;C:\Python27\Lib\site-packages\Django\bin;
            >to extpath add .PY
 and then hit ok button couple of times and close all the command window  

Project Creation: 
To create a project, create a folder say Djang in C:\ as 
     C:\Django-admin.py startproject project_name


********If it does not work here, checkout the following:*********
>Type regedit in run window
>Goto HKEY_CLASSES_ROOT>py_auto_file>command
   and change the current value to 
Now type ""C:\Python27\python.exe" "%1"%*" instead of the current value
and there you go...
   After that cd to the foldr of your project and 
 type:
         python manage.py runserver
 Check out the result by typing localhost:8000 in your browser. You should be getting  the same  as given below

Happy Coding!

No comments:

Post a Comment

 

Blogroll

About