Django - Creating A Project
Django - Creating A Project
htm
Chapters Categories
Now that we have installed Django, let's start using it. In Django, every web app you
want to create is called a project; and a project is a sum of applications. An
application is a set of code files relying on the MVT pattern. As example let's say we
want to build a website, the website is our project and, the forum, news, contact
engine are applications. This structure makes it easier to move an application between
projects since every application is independent.
Create a Project
Whether you are on Windows or Linux, just get a terminal or a cmd prompt and
navigate to the place you want your project to be created, then use this code −
myproject/
manage.py
myproject/
__init__.py
settings.py
urls.py
wsgi.py
1 of 6 09-06-2025, 22:35
Django Creating Project https://www.tutorialspoint.com/django/django_creating_project.htm
The myproject subfolder − This folder is the actual python package of your
project. It contains four files −
urls.py − All links of your project and the function to call. A kind of ToC
of your project.
DEBUG = True
This option lets you set if your project is in debug mode or not. Debug mode lets you
get more information about your project's error. Never set it to True for a live project.
However, this has to be set to True if you want the Django light server to serve static
files. Do it only in the development mode.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'database.sql',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
2 of 6 09-06-2025, 22:35
Django Creating Project https://www.tutorialspoint.com/django/django_creating_project.htm
Database is set in the Database dictionary. The example above is for SQLite engine.
As stated earlier, Django also supports −
MySQL (django.db.backends.mysql)
PostGreSQL (django.db.backends.postgresql_psycopg2)
MongoDB (django_mongodb_engine)
Before setting any new engine, make sure you have the correct db driver installed.
You can also set others options like: TIME_ZONE, LANGUAGE_CODE, TEMPLATE
Now that your project is created and configured make sure it's working −
You will get something like the following on running the above code −
Validating models...
0 errors found
September 03, 2015 - 11:41:50
Django version 1.6.11, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
3 of 6 09-06-2025, 22:35