DEV Community

Cover image for Django for Web - 101
Sajjad Rahman
Sajjad Rahman

Posted on

Django for Web - 101

Welcome to Django - 101

This is the basic how to create a Django project.

Why Django

It is an open-source project and Django is a full-stack web framework for Python, providing a more comprehensive solution than Flask. However, I aim to deploy a model rather than develop a full-stack product.

What do I do

at first, we install Python
if it is not available on our local computer.

pip install Django
Enter fullscreen mode Exit fullscreen mode

if it is avail it shows a message below, other than it takes a few seconds
:)
Image description

It's time to create our project. Kudus !!!

  1. Open a terminal and navigate to the directory where you want to create your project.

  2. Run the following command to create a new Django project. Replace "myproject" with the desired name for your project:

django-admin startproject project_name
example: 
django-admin startproject myproject
Enter fullscreen mode Exit fullscreen mode

Image description

  1. Change into the project directory:
cd myproject
Enter fullscreen mode Exit fullscreen mode

open the project with vs-code and select git-bash as a terminal.

Image description

  1. Now, let's create a Django app. Apps are components within a project that handle specific functionalities. Run the following command to create an app. Replace "myapp" with the desired name for your app:
python manage.py startapp myapp
Enter fullscreen mode Exit fullscreen mode

after run the command we can see myapp is inside the myproject

Image description

  1. Now we run our app
      python manage.py runserver
Enter fullscreen mode Exit fullscreen mode

After running this command we can see the output likes

Image description

if you see something in your picture number 3 your project is done.

Congratulations! You've just created a basic Django project with a simple app.

My next post will be how to see the output after creating the project. Till then stay tuned and learn together.

% connect with me on social  %
Enter fullscreen mode Exit fullscreen mode

Top comments (0)