Esempio n. 1
0
LDAP_SEARCH_DN = os.environ.get('LDAP_SEARCH_DN', None)
if all([AUTH_LDAP_SERVER_URI, LDAP_SEARCH_DN]):
    from ._ldap import *   # noqa

# geoaxis
GEOAXIS_ENABLED = str2bool(os.getenv('GEOAXIS_ENABLED', 'False'))
if GEOAXIS_ENABLED:
    GEOAXIS_HEADER = os.getenv('GEOAXIS_HEADER', None)
    AUTHENTICATION_BACKENDS = (
        'django.contrib.auth.backends.RemoteUserBackend',
    ) + AUTHENTICATION_BACKENDS
    for i, middleware in enumerate(MIDDLEWARE_CLASSES):
        # Put custom middleware class after AuthenticationMiddleware
        if middleware == 'django.contrib.auth.middleware.AuthenticationMiddleware':
            MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
            MIDDLEWARE_CLASSES.insert(i+1, 'exchange.auth.middleware.GeoAxisMiddleware')


# NEED TO UPDATE DJANGO_MAPLOOM FOR ONLY THIS ONE VALUE
REGISTRY = os.environ.get('ENABLE_REGISTRY', False)
REGISTRYURL = os.environ.get('REGISTRYURL', None)
REGISTRY_CAT = os.environ.get('REGISTRY_CAT', 'registry')
REGISTRY_LOCAL_URL = os.environ.get('REGISTRY_LOCAL_URL', 'http://localhost:8001')

# If django-osgeo-importer is enabled, give it the settings it needs...
if 'osgeo_importer' in INSTALLED_APPS:
    import pyproj
    # Point django-osgeo-importer, if enabled, to the Exchange database
    OSGEO_DATASTORE = 'exchange_imports'
    # Tell it to use the GeoNode compatible mode
    OSGEO_IMPORTER_GEONODE_ENABLED = True
Esempio n. 2
0
LDAP_SEARCH_DN = os.getenv('LDAP_SEARCH_DN', None)
if all([AUTH_LDAP_SERVER_URI, LDAP_SEARCH_DN]):
    from ._ldap import *   # noqa

# geoaxis
GEOAXIS_ENABLED = str2bool(os.getenv('GEOAXIS_ENABLED', 'False'))
if GEOAXIS_ENABLED:
    GEOAXIS_HEADER = os.getenv('GEOAXIS_HEADER', None)
    AUTHENTICATION_BACKENDS = (
        'django.contrib.auth.backends.RemoteUserBackend',
    ) + AUTHENTICATION_BACKENDS
    for i, middleware in enumerate(MIDDLEWARE_CLASSES):
        # Put custom middleware class after AuthenticationMiddleware
        if middleware == 'django.contrib.auth.middleware.AuthenticationMiddleware':  # noqa
            MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
            MIDDLEWARE_CLASSES.insert(
                i + 1, 'exchange.auth.middleware.GeoAxisMiddleware')

# NearSight Options, adding NEARSIGHT_ENABLED to env will enable nearsight.
NEARSIGHT_ENABLED = str2bool(os.getenv('NEARSIGHT_ENABLED', 'False'))
if NEARSIGHT_ENABLED:
    NEARSIGHT_UPLOAD_PATH = os.getenv(
        'NEARSIGHT_UPLOAD_PATH', '/opt/nearsight/store')
    NEARSIGHT_LAYER_PREFIX = os.getenv('NEARSIGHT_LAYER_PREFIX', 'nearsight')
    NEARSIGHT_CATEGORY_NAME = os.getenv('NEARSIGHT_CATEGORY_NAME', 'NearSight')
    NEARSIGHT_GEONODE_RESTRICTIONS = os.getenv(
        'NEARSIGHT_GEONODE_RESTRICTIONS', 'NearSight Data')
    DATABASES['nearsight'] = DATABASES['exchange_imports']
    CACHES = locals().get('CACHES', {})
    CACHES['nearsight'] = CACHES.get('nearsight', {
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        'LOCATION': NEARSIGHT_UPLOAD_PATH,