Django has an inbuilt server. All of us are aware that we can simply start the server using the following command.

python manage.py runserver

Then what about in the production, is it the same command used for running our Django project in production.

Well Absolutely No.

The Django inbuilt server is created for development purposes, where the developer can see all the API’s or Views are working correctly and what are the responses of that API’s.

It is also designed in such a manner keeping fewer amount of users in consideration…


A JWT stands for Json Web Token. It’s simply a token which is used between the request-response cycle of API calls.

It is used for the authorization of users. This JWT contains information about the logged-in user. So in every API call, the server knows who is the user requesting the service and based on his permissions it gives access to requested services.

So now you know what JWT is. one interesting fact of JWT is, it is not stored on the server but on the…


Django has general and well-known queries like which are mostly used, these are generally used for getting objects/records of a single database table

models.objects.all()
models.objects.filter()
models.objects.get()

If you want to join Django [when you want to join two database tables having a Foreign-key relation], then we generally fetch all objects/records from the database and run a For loop where every record is joined with its related table record.

Lets us see the number of queries fired in every case:
1. one query to fetch all the objects.
2. “ N ” queries for every record in for loop


adding multiple databases in Django and how to use them

DATABASES = {  'default': {               'ENGINE': 'django.db.backends.mysql',
'NAME': 'DB1 Name',
'USER': 'username',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {
# 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
'charset': 'utf8mb4',
},
},
'social': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DB2 Name',
'USER': 'username',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {
# 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
'charset': 'utf8mb4',
},
}
}

The migrate command can operate only one database at a time. By default, it operates on the default database, but by providing the — database you can tell it to synchronize other databases also…


Impement pagination in django using drf and APIView

Pagination helps to retrieve the data from the database as a limited record per page. Often pagination is implemented using the generics views.

APIView in DRF is one of the simplest ways to implement API’s with all CRUD operations in a single view. But when comes to pagination it doesn't provide the same as Generic views.

Often we require pagination in only get methods of API and none of the others don't require them. Here is the entire clear-cut representation with code that helps to implement pagination in APIView.


Lets see the memory allocation in the array, when an array of size n is declared a certain continuous block of memory is allocated for that.

for example when an array of size 5 declared each unit occupying 2 bytes and memory continuous block if started from 1000 then allocated memory is from address 1000 to 1010.

Here a continuous memory after allocated the next memory is used by other variables or any other data. so next 1011 space is occupied. when we try to insert a new element in that array. …


lets us the memory allocation in the array, when an array of size n is declared a certain continuous block of memory is allocated for that.

Array indexing starts from 0

for example when an array of size 5 declared each unit occupying 2 bytes and memory continuous block if started from 1000 then allocated memory is from address 1000 to 1008

Bhavani shanker

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store