Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django SerializerDoesNotExist 'geojson'?

I'm trying to serialize data in the geojson format however whenever I use

json = serialize("geojson", coordinate.objects.all())
response = HttpResponse(json)
return response

django gives me

SerializerDoesNotExist at /getmarkers/ 'geojson'

this works fine

json = serialize("json", coordinate.objects.all())

surely anyone else who has tried using the geojson serializer has ran into the same issue. I've installed the GDAL library as told to do so in the docs. Any ideas? Can't seem to really find anything in the docs about what modules must be imported I've tried

from django.contrib.gis import gdal

Does not throw an error but also does not fix the issue I'm using Django 1.8

like image 548
Groovietunes Avatar asked May 25 '15 22:05

Groovietunes


1 Answers

You need to include the geojson serializer in settings.py

SERIALIZATION_MODULES = {
    "geojson": "django.contrib.gis.serializers.geojson", 
 }
like image 68
CormacMOB Avatar answered Sep 24 '22 09:09

CormacMOB