How to Setup a Django Application

Django is a widely-used server-side web framework written in Python. It comes pre-packaged with built-in components, including admin interface, user authentication, forms, object-relational mapping (ORM), etc. This makes Django very suitable for rapid development that requires low learning curve. Another reason to choose Django is that it uses Python, which is rich in features for machine learning, data processing, etc. This makes it easy to integrate the machine learning modules directly into your web application.

Here, we will go through the process of setting up a simple Django application. This assumes you have basic understanding of Python programming language.

 1. Setting Up Virtual Environment

Create a virtual environment for your Django application.

python -m venv site

Activate the virtual environment

For MacOS/Linux

source site/bin/activate

2. Install Django

Install Django using pip installer

pip install django

3. Create and Run the Project

Create a project with the following command

django-admin startproject TicketBooking

Verify that everything works by navigating to your project directory

cd TicketBooking

Start the server

python manage.py runserver

Then, open your web browser and navigate to

What’s Next?

Now that you have a working Django project, you can explore plenty of additional Django capabilities that may suit your objectives.

In Django, a project can consist of multiple applications. Each application is a module that serves specific objective, and it can be reused across different projects. Examples include the admin module and authentication module that you can see inside INSTALLED_APPS in the settings.py file.

Admin Interface

Initialize the database with the following command, which will create the necessary database and tables required for the apps inside the project to run.

python manage.py migrate

Next, we create a superuser

python manage.py createsuperuser

Now start the server

python manage.py runserver

Open your browser and go to:


Congratulations on reaching the end of this tutorial! We’ve learned how to set up a basic Django project. Then we dived into the admin interface Lastly, you explored the Django admin interface, which is an out-of-the-box solution for content management. For more information, please visit the official documentation. Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *