1

I have a simple django app using sqlite3. My app is simple I have django user authentication system where the user can be upload spatial raster images and can see that images in user personal HTML page filter by use id.

Here is my model :

class nomodel(models.Model):
    name = models.TextField()
    user = models.ForeignKey(User, unique=True)
    upload = models.ImageField(upload_to=user_directory_path)

sqlite3 database :

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

But that way is not GIS way to work with leaflet to add this raster in open layers.

If I change my code to :

from django.contrib.gis.db import models

class testRaster(models.Model):
    raster_id = models.TextField(primary_key=True, default=1)
    name = models.TextField(default='test_layer')
    raster = models.RasterField()
    #user = models.ForeignKey(User, unique=True)
    #raster = models.RasterField(upload_to=user_directory_path)


DATABASES = {
    'default': {
         'ENGINE': 'django.contrib.gis.db.backends.postgis',
         'NAME': 'geodjango',
         'USER': 'geo',
    },
}

but my question is because never use PostGIS in the past is in sqlite3 in upload field save the image path from my nomodel model but in the raster field from testRaster model save again the path of images ?

in testRaster ant PostGIS database can I use again user authentication like sqlite3 model ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.