Well the amount of time taken depends on the Internet speed. This tutorial assumes that you are working on Linux(Debian/Ubuntu), if not I recommend you Install one of those distros on dual-boot or on VMware/Oracle VM VirtualBox.
Install python pip, which is a tool for installing and managing python packages. Pop out the terminal and start inputing the following code.
sudo apt-get install python-pip
Installing DJango
sudo pip install django
To check for the correct installation
python -c "import django;print django.get_version()"
At this point Django supports three database engines
- PostgreSQL
- SQLite 3
- MySQL
We will focus on installing SQLite and MySQL
Setting up SQLite
If you’re using a Python version over 2.5, you already have SQLite. If you’re working with Python 2.4 or older, you’ll need SQLite 3— not version 2. I assume that you are using Python version over 2.5.
sudo apt-get install python-pysqlite2
To check for the correct installation
python -c "import sqlite3;print sqlite3.version"
Setting up MySQLdb
This is a bit tricky, as many errors will pop out during this installation. The following steps worked out fine for me
Installing MySQL server
sudo apt-get install mysql-server sudo apt-get install libmysqlclient-dev
Installing MySQLdb
easy_install -U distribute sudo apt-get install python-mysqldb
To check for the correct installation
python -c "import MySQLdb;print MySQLdb.version_info"
Starting the server
Pop out another terminal and change to the directory in which you want to start your project, in my case the name of the project is mysite and the directory in which I am going to have my projects is workspace
cd ~ mkdir workspace
After creating the directory, call out django-admin.py to start the django project, which will create the basic project structure
cd workspace django-admin.py startproject mysite cd mysite python manage.py runserver 0.0.0.0:8000
If there are not any errors, then the output should look something like this
0 errors found December 11, 2013 - 17:51:52 Django version 1.6, using settings 'mysite.settings' Starting development server at http://0.0.0.0:8000/ Quit the server with CONTROL-C.
Here 0.0.0.0 is for in case you want to access the webapp from a different machine, whereas 8000 is the port on which the webapp is accessible. localhost will also work with the above IP, port can be changed according to your convenience. If you want to access this webapp from other machine go to web browser and type
your_ip:8000
In case you want to make it accessible only to your machine, then change it to 127.0.0.1:8000 and type in the browser
127.0.0.1:8000 or localhost:8000