Skip to content

karki-03/django-rest-framework-basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

django-rest-framework-basics

Django is based on MVT (Model-View-Template) architecture.

MVT Structure has the following three parts –

Model: The model is going to act as the interface of your data. It is responsible for maintaining data. It is the logical data structure behind the entire application and is represented by a database (generally relational databases such as MySql, Postgres).

View: The View is the user interface — what you see in your browser when you render a website. It is represented by HTML/CSS/Javascript and Jinja files.

Template: A template consists of static parts of the desired HTML output as well as some special syntax describing how dynamic content will be inserted.

Setting up Virtual environment

  1. pip install virtualenvwrapper-win
  2. mk virtualenv custom_virtual_env_name

To work inside a already created v. env.

  1. workon custom_virtual_env_name

Setting up django inside v. env.

  1. pip install djangorestframework
  2. pip install markdown # Markdown support for the browsable API.
  3. pip install django-filter # Filtering support

Creating new project

  1. django-admin startproject mysite

To make new apps inside the project

  1. python manage.py startapp polls

To run the server

  1. python manage.py runserver

Migrations

  1. python manage.py makemigrations

Your models will be scanned and compared to the versions currently contained in your migration files, and then a new set of migrations will be written out.

Once you have your new migration files, you should apply them to your database to make sure they work as expected:

  1. python manage.py migrate

Resources

A. Resources for uploading a file: https://blog.vivekshukla.xyz/uploading-file-using-api-django-rest-framework/

B. Resource for CRUD operation: https://medium.com/swlh/django-rest-framework-crud-with-drf-9a8756095c73

C. Making OAuth2 setup using Django Oauth Toolkit (DOT) https://django-oauth-toolkit.readthedocs.io/en/latest/getting_started.html

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published