Django Project Creation - Django Examples | W3schools

After the successful installation of Django, now, we can move forward to our first project creation using Django. A project refers to a web application or a group of web applications which you are looking forward to creating on this framework. And you can define an application as a code file based on the MVT pattern that you have studied already. For instance, you can consider a website as a project and its application will include its forum section, news section, or any other sections which lead to different operations. Applications are independent in nature and that’s why it is easy to include them in any of your desired projects.

Also Read: Django Environment and Installation

Project Creation
If you are a Windows user then open the command prompt and if you are a Linux user then go for the terminal. Now, navigate to the folder or path where you want your project to be created. After this, type in the following command:

$ django-admin startproject myproject


The above command will create a myproject folder under your desired path and the structure of the folder will be similar to the following:


Structure of the Project
Here, myproject directory is just a container of two major elements, which are:

1. : This file acts as a local Django admin for your project. You can easily interact with with the help of command prompt or the terminal. These interactions can include starting of the development server, syncing of the database, and many more. To see all the commands that you can access through, type in the following command either on the cmd:

$ python help

2. sub-folder under the name of ‘myproject’ : This is the real package of your project which directly deals with the Python language. This sub-directory consists of 4 files, which are:

* : This folder can be considered as the package and it deals with Python only.

* : This folder carries all the settings associated with your project.

* : This folder contains all the links and the functions that your project requires. Also, this is the folder which acts as your project’s ToC.

* : This folder comes into picture whenever you want to deploy your project over the WSGI.

Project Set Up
You can locate your project under the path myproject/ After locating your project, you need to set some major options. You can start with the below provided option:


DEBUG = True

This DEBUG option help your application to understand if you have set the debug mode for your project or not. By setting DEBUG mode to true, you allow fetching of more data and information about the errors of your project. It would be recommendable not to set it true for any of your live projects. Though this is a very helpful option, in case, you want the Django light server to serve static files. This needs to be done in the development mode.

   ‘default’: {
      ‘ENGINE’: ‘django.db.backends.sqlite3’,
      ‘NAME’: ‘database.sql’,
      ‘USER’: ”,
      ‘PASSWORD’: ”,
      ‘HOST’: ”,
      ‘PORT’: ”,

You can find your associated database under the Database dictionary. The above example is associated with the SQLite 3 engine. As already mentioned earlier Django supports a few major database engines, which are:

* MySQL (django.db.backends.mysql)
* PostGreSQL (django.db.backends.postgresql_psycopg2)
* Oracle ( and NoSQL DB
* MongoDB (django_mongodb_engine)

Now, before you go ahead with any of the above mentioned engines, ensure that you have already installed the appropriate database driver for it. There are a few other options available which include TIME_ZONE, LANGUAGE_CODE, TEMPLATE, and many others.

Well, at the final step, you are required to ensure whether your recently created and configured project is working properly or not. For that, run the following command on the cmd or on the terminal:

$ python runserver

The successful working will display an output which will appear somewhat like the following one:


Validating models…

0 errors found
September 03, 2015 – 11:41:50
Django version 1.6.11, using settings ‘myproject.settings’
Starting development server at
Quit the server with CONTROL-C.