Django Tutorial: Build Your First App from Scratch

Django Tutorial: Build Your First App from Scratch
Photo by faisaldada on Unsplash
2 mins read
16 Likes
331 Views

What is Django?

Django is a framework usually written in Python. It gives us a lot of shortcuts that reduce our time while developing business logics Business logic means writing controller in views.py (mainly) describing how to connect with data bases

Some important points that we should give focus before building a project in Django or any Framework :

  1. Always setup a virtual environment
  2. Always write logics in views.py
  3. Always write models in models.py
  4. Write serializers after making a serializers.py file into your created application

Lets get Started!!

  1. First of all you will need an editor for making a django project "Notepad se kaam ni chalega".
  2. You must have your laptop powered on.

We’ll assume you have Django installed already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix):

$ python -m django --version

Make a folder on your desktop and right-click on it to open it in terminal. Once it started in terminal then write

 django-admin startproject projectkanaam  

Then a file will be created in your folder that you have created on your desktop.

Now right click on the created folder which is named as "projectkanaam" and open with your VS code.

Now open terminal as you want but here is a shortcut key "CTRL+SHIFT+~"

In your terminal write the following command

python manage.py start app appkanaam

Now another file will be created in your root directory names as appkanaam.

Share:

Comments

0

Join the conversation

Sign in to share your thoughts and connect with other readers

No comments yet

Be the first to share your thoughts!