How to create django project?

Steps to create a Django project

  1. Install and check version of Python
  • Check if pip is installed pip -V (Tells you version of pip)
  • Create a project directory (mkdir RBS) cd to project directory (cd rbs)
  • Create a virtual environment => D:\RBS>python3 -m venv rbs-env

Check the directory, You can see  the directory rbs-env is created

  • Activate virtual environment => D:\RBS>.\rbs-env\scripts\activate

You will see a created virtual environment inside the parentheses

  • Check the directory

(rbs-env) D:\RBS>dir

You will see the following….

6. Install Django => (rbs-env) D:\RBS>pip install Django

7. Check django version => (rbs-env) D:\RBS>django-admin –version

5.0.4 [Django version is displayed)

8. Create a Django project => (rbs-env) D:\RBS>django-admin startproject rbs

9.  See the files and directory created (rbs-env) D:\RBS>dir 

10. Change directory to rbs and check the directory

 => (rbs-env) D:\RBS>cd rbs

=> (rbs-env) D:\RBS\rbs>dir

11.  Run the server => (rbs-env) D:\RBS\rbs>python3 manage.py runserver

12. Open any web browser (Google chrome or Edge) and type

http://localhost:8000/ and press enter OR  http://127.0.0.1:8000/ and press enter


Now we have created a Django project!

The next step is to create an app in your project.

What is an App?

In Django project, an app is a web application that has a specific meaning, like a home page, a contact form, or users.

Now we will create an app that allows to register and list users s in a database.

First, let us create an app that display “Namaskar  Bharath”

Create an app “users”

Django creates a folder “users” in the project rbs

There are some files and folders with a specific meaning.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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