To download Django:
To install Django:
$ sudo python setup.py install
or
$ sudo pip install Django --upgrade
$ sudo pip3 install Django --upgrade
or
$ sudo pip install django==1.8
$ sudo pip3 install django==1.8
To verify the version of Django, type the following in the Python Shell:
import django
print django.VERSION
The constant VERSION is located in in site-packages/django/__init__.py
To create a new site:
django-admin.py startproject mysite
This command will create a directory 'mysite' with four files inside:
mysite/
__init__.py
manage.py
settings.py
urls.py
$ python manage.py help # type this at the terminal command prompt
To create a new app:
cd mysite
python manage.py startapp app_name
To start an Django interactive shell:
python manage.py shell
To define database layout:
define subclass from base class django.db.models.Model in file models.py (should have created by the startapp command).
To validate the models:
python manage.py validate
To generate SQL statements from models:
python manage.py sqlall app_name
To auto create tables for all INSTALL_APPS:
python manage.py syncdb
To access database's server command prompt:
python manage.py dbshell
To start the development server:
cd mysite
python manage.py runserver
default port is 8000
To share your development server with another port number, use the following command (this example uses port 8080):
python manage.py runserver 0.0.0.0:8080
The file that maps the URL's
mysite/urls.py
URL Processing:
Template Directory: