Project Set Up

1. Create a Django Project

Type the below command in terminal. (refer Fig. 1.8)

django-admin startproject TodoList
Fig. 1.8 Django Start Project

2. Navigate to Your Project.

Type the below command in terminal. (refer Fig. 1.9)

cd TodoList
Fig. 1.9 Change directory to TodoList Project file.

3. Running Project

As far project file is created. Now run the project in local server.

Type the below command in terminal. (refer Fig. 1.10)

py manage.py runserver
Fig. 1.10 Running project in local server.

4. Django Default Web Application

Now server is running. Type "http://127.0.0.1:8000" in browser. We get the default web application in browser. (refer fig. 1.11)

Type the below line in web browser. (refer Fig. 1.11)

http://127.0.0.1:8000
Fig. 1.11 Default Django application.

5. Create Django App

Django apps are components within a project. Use the following command to create an app: ( refer Fig. 1.12)

py manage.py startapp todo
Fig. 1.12 Create a Django App

6. Configure the App in Settings

Open the settings.py file in your project directory (TodoList/settings.py) and add your app to the INSTALLED_APPS list:

INSTALLED_APPS = [
    # ...
    'todo',
]
Fig. 1.13 Configure the app in settings.

7. Create a urls.py file in todo app folder (refer fig. 1.14)

note: just leave the urls.py file empty.

Fig. 1.14 todo urls.py

8. Register the todo app urls.py file in project urls.py (refer fig. 1.15)

Fg. 1.15 Register app urls.py in project urls.py

Last updated