'Django Postgres PostGISSpatialRefSys matching query does not exist

I am implementing location feature in my Django project with Postgresql as my database, so for that I install Postgres and then install PostGis extension

I have the following filter query executed in my views.py

from django.contrib.gis.measure import D
from django.contrib.gis.db.models.functions import Distance

Lesson.objects.filter(venue_coord__distance_gte=(request.user.location_coord, D(km=int(km)))

Executing the above filter results in error: PostGISSpatialRefSys matching query does not exist

enter image description here

In models.py I have venue_coord & location_coord that stores PointField as follows

venue_coord = models.PointField(verbose_name=_(" Venue Co-ord"), blank=True, null=True)
location_coord = models.PointField(verbose_name=_(" User Co-ord"), blank=True, null=True)

Can anyone suggest why postgis is giving error all of a sudden.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source