The Project Structure
Let us first discuss the project structure in detail and understand the files that we got by executing the command above.
The “demoproject” folder has two elements
Manage.py- this file is a kind of local Django admin that helps the project to interact with your command line. To get a full list of the commands accessible via manage.py you use the following command.
$ python manage.py help
It will open a list of all command

The “demoproject” subfolder- this folder contains all the actual python packages of your project. It contains the following files-
__intit__.py: it is a python package.
settings.py: it contains all the settings related to your project.
urls.py: All links of project and function calls
wsgi.py: if you need to deploy your project over WSGI.
Learn more, wget command in linux
Setting up your project
Create a new file views.py inside the subfolder named “demoproject” and copy the following code in the file.
from django.http import HttpResponse
# Defining a function
def demo (request):
return HttpResponse("Hello Ninja")

You can also try this code with Online Python Compiler
Run Code
Open the urls.py and your entry for above code
from demoproject.views import demo

You can also try this code with Online Python Compiler
Run Code
Add entry in url field inside urlpatterns
path('demoproject/',demo),

You can also try this code with Online Python Compiler
Run Code
Now run the server
Open command prompt and change the working directory to env_site by using the following command
$ cd env_site

You can also try this code with Online Python Compiler
Run Code
Once we are in the env directory use the below commands to activate the virtual environment
$ cd Scripts
$ activate

You can also try this code with Online Python Compiler
Run Code
Change the working directory to demoproject -
$ cd ..
$ cd demoproject

You can also try this code with Online Python Compiler
Run Code
Start the server
$ python manage.py runserver
Open the browser and type this url-
http://127.0.0.1:8000/demoproject/
Output:

Frequently Asked Questions
-
How to create a project directory in Django?
To create a project directory open the cmd and type the following code
django-admin startproject demoproject
-
What is Django?
Django is a free and open-source Python-based web framework that employs the Model–template–views design pattern.
-
What are some companies that use Django?
Instagram, DISCUS, Mozilla Firefox, YouTube, Pinterest, Reddit, and other companies use Django.
Key Takeaways
In this article we discussed about creating a project in Django and also implemented a demo project to develope the understanding of django. We briefly discussed about the folder structure of the project along with some important commands.
You can also refer to Django Templates, Django Forms and CRUD operations in Django.
Happy Learning!