DEV Community

Cover image for Create a Django app in less than 2 minutes
pravintargaryen
pravintargaryen

Posted on

Create a Django app in less than 2 minutes

Django is a Popular Web framework in the pythonic world since its inception in 2005 as there's consistent growth of developers and users alike ever since.

A Django site.

If you love Python in the Backend, creating a Django app is more fun than you thought.

Virtual environment (venv)

Virtual environment makes sure the packages and dependencies you install do not end up globally in the site-packges folder of your Python installation directory and in the current project folder.

The following command will create a virtual environment in the current working directory

py -m venv venv
Enter fullscreen mode Exit fullscreen mode

You can activate your virtual environment using the command (in windows)

.\venv\Scripts\activate
Enter fullscreen mode Exit fullscreen mode

Once you have your virtual environment activated, we are ready to go.

Installing Django

Django package can be installed with following command

py -m pip install Django
Enter fullscreen mode Exit fullscreen mode

After the installation is completed, we can start a new Django project

django-admin startproject demo .
Enter fullscreen mode Exit fullscreen mode

Image description

Notice the presence of '.' a dot at the end of the command. Omitting this dot will result in a nested project structure same as our app name 'demo1'(in this case)

Image description

Starting the Dev Server

Now that we have our demo project created, let's check if our django app is installed properly

py manage.py runserver
Enter fullscreen mode Exit fullscreen mode

You will notice certain warnings about migrations which you can ignore for now

Image description

That's it. We now have our first Django app up and running

Image description

Top comments (0)