Sami Ullah Saleem
Posted on December 3, 2022
- Install Django using command
pip install django
- Create a project using command
django-admin startproject <projectname>
- Move to your project directory like mine is api
- Now, it's time to create an app. We can have multiple apps in single project
- The command is
python manage.py startapp Bookapi
- Don't forget to write your app name under installed_apps in settings.py file of your project folder
- Now go to BookApi directory and there click models.py
Model is actually convert your python code to the database which you are using
- Now, go to views.py file under BookAPI directory Views are used to create and retrieve data from an end point
- Now, create a file urls and copy the code from urls file of your project Folder and paste in the urls file of your application
Urls are used to create endpoints and call views to send and receive data
- Now, go to urls of your project
- Now create migrations using command
python manage.py makemigrations
- Now migrate
python manage.py migrate
Now, run
Python manage.py runserver
💖 💪 🙅 🚩
Sami Ullah Saleem
Posted on December 3, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.