- Django - Home
- Django - Basics
- Django - Overview
- Django - Environment
- Django - Creating a Project
- Django - Apps Life Cycle
- Django - Creating Views
- Django - URL Mapping
- Django - Index Page
- Django - Templates System
- Django - MVT
- Django - Add Master Template
- Django Admin
- Django Admin - Interface
- Django Admin - Create User
- Django Admin - Include Models
- Django Admin - Set Fields to Display
- Django Admin - Update Objects
- Django Models
- Django - Models
- Django - Insert Data
- Django - Update Data
- Django - Delete Data
- Django - Update Model
- Django Static Files
- Django - Add Static Files
- Django - Add CSS Files
- Django Advanced
- Django - Page not Found (404)
- Django - Page Redirection
- Django - Sending E-mails
- Django - Generic Views
- Django - Form Processing
- Django - File Uploading
- Django - Apache Setup
- Django - Cookies Handling
- Django - Sessions
- Django - Caching
- Django - Comments
- Django - RSS
- Django - AJAX
Django Environment Setup
Django development environment consists of installing and setting up Python, Django, and a Database System.
Because Django deals with web application, so its worth mentioning that you would need a web server setup as well.
Step 1 - Installing Python:
Django is written in 100% pure Python code, so you'll need to install Python on your system. Django requires Python 2.3 or higher.
If you're on Linux or Mac OS X, you probably already have Python installed. You can verify it by typing python command at a command prompt. If you see something like this, then Python is installed:
$ python Python 2.4.3 (#1, Sep 3 2009, 15:37:12) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 |
Otherwise you can download and install latest version of Python from the link http://www.python.org/download.
Step 2 - Installing Django:
Installing Django is very easy, but the steps required for its installation depend on your operating system. Since Python is a platform-independent language, Django has one package that works everywhere regardless of your operating system.
you can download latest version of Django from the link http://www.djangoproject.com/download.
UNIX/Linux and Mac OS X Installation:
If you are working on UNIX/Linux and Mac OS X, then you need to run the following commands in the directory where the Django-x.xx.tar.gz archive is located. These commands will extract the archive and install Django for you:
$ tar xzvf Django-x.xx.tar.gz $ cd Django-x.xx $ sudo python setup.py install |
You can test your installation by running this command:
$ django-admin.py --version |
If you see the current version of Django printed on the screen, then everything is set.
Windows Installation:
Extract zipped tar file and change the current directory to where you extracted Django by issuing the following command, where x.xx is your Django version:
c:\>cd c:\Django-x.xx |
Next, install Django by running the following command for which you will need administrative privileges:
c:\Django-x.xx>python setup.py install |
To test your installation, open a command prompt and type the following command:
c:\>django-admin.py --version |
If you see the current version of Django printed on screen, then everything is set.
Step 3 - Database Setup:
Django supports several major database engines and you can setup any of them based on your comfort.
You can refer to respective documentation to installing and configuring a database of your choice.
Step 4 - Web Server:
Django comes with a lightweight web server for developing and testing applications. This server is pre-configured to work with Django, and more importantly, it restarts whenever you modify the code.
However, Django does support Apache and other popular web servers such as Lighttpd.
I will discuss both the approaches in coming chapters while working with different examples.
|
Advertisements |