feat: env variable for map location

This commit is contained in:
relikd
2024-07-28 12:58:26 +02:00
parent 571d8fdb56
commit 63ea55472f
2 changed files with 6 additions and 2 deletions

View File

@@ -34,8 +34,8 @@ class Place(models.Model):
description = models.TextField('Beschreibung', blank=True, null=True) description = models.TextField('Beschreibung', blank=True, null=True)
location = LocationField('Position', blank=True, null=True, options={ location = LocationField('Position', blank=True, null=True, options={
'map': { 'map': {
'center': [52.52, 13.40], 'center': settings.MAP_CENTER,
'zoom': 12, 'zoom': settings.MAP_ZOOM,
}, },
}) })

View File

@@ -138,6 +138,10 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
ADMIN_URL = os.environ.get('ADMIN_URL', 'admin/').rstrip('/') + '/' ADMIN_URL = os.environ.get('ADMIN_URL', 'admin/').rstrip('/') + '/'
[slat, slon] = os.environ.get('MAP_CENTER', '51.2,9').split(',')
MAP_CENTER = [float(slat), float(slon)]
MAP_ZOOM = int(os.environ.get('MAP_ZOOM', '6'))
STATIC_ROOT = BASE_DIR / 'static' STATIC_ROOT = BASE_DIR / 'static'
MEDIA_URL = 'data/' MEDIA_URL = 'data/'