Integrating GeoDjango into an Existing Django Project

I have a Django project with several applications. They all share db with engine = django.db.backends.postgresql_psycopg2. Now I want some functions GeoDjangoand decided that I want to integrate it into my existing project. I read a tutorial, and it looks like I need to create a separate spatial database for GeoDjango. Interesting, anyway. I tried adding this to one of my .py model models without changing the db settings:

from django.contrib.gis.db.models import PointField

class Location(models.Model):
        location = PointField()

But when I run syncdb, I got this error.

File "/home/virtual/virtual-env/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 200, in db_type
    return connection.ops.geo_db_type(self)
+5
source share
3 answers

, , django.contrib.gis.db.backends.postgis postgresql_psycopg2, db , db , db ( ). geodjango , , , db.

- django multi-db db geodjango.

+2

: . , PostGIS , . , .

+1

100%, , postgis.sql spaces_ref_sys.sql , db "django.contrib.gis.db. backends.postgis". ( , , , )

https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#spatialdb-template

, . , postgis - , , .

0
source

All Articles