Learning backend using Django. Creating CRUD operation using Django .
- python -m venv env // for creating the virtual environment
- env/Script/activate // activate virtual enironment
- create a new folder and cd newforder
- pip install djangorestframework // run command inside the newfolder
- django-admin startproject main . // command for initiallization of new project
- go inside project (main/setting.py) inside settings.py update in { INSTALLED_APPS = ['rest_framework'] }
- python manage.py migrate // initial migrate command for migrating default models like admin and etc...
- python manage.py runserver // for running the server
- python manage.py createsuperuser // creating the super user({admin,root}) for login in admin pannel
- python manage.py runserver goto {http://127.0.0.1:8000/admin/} //run the server again and try to login as {admin,root}
- python manage.py startapp home // creating app (home)
- go inside project (main/setting.py) inside settings.py update in { INSTALLED_APPS = ['home'] }
- creating models inside (home/models.py) create a class and define the fields
- go inside (home/admin.py) and register the model
- python manage.py makemigrations // now make the migration for model
- python manage.py migrate // now migrate the updates of model
- create a file of (serializer.py) and setup serializer
- go to (home/views.py) create api using APIViews (get function)
- goto (main/usls.py) and create a path for {home/} url