diff --git a/.travis.yml b/.travis.yml index 246a508ab26..e73300e3ef1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -207,7 +207,7 @@ install: sudo apt-get install -y python-virtualenv python-imaging python-lxml python-pyproj python-shapely python-httplib2 python-httplib2 gettext; sudo apt-get install -y python-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev libpq-dev libgdal-dev git default-jdk; sudo apt-add-repository -y ppa:jonathonf/backports; - sudo apt-get -y update && sudo apt-get install -y sqlite3; + sudo apt-get -y update && sudo apt-get install -y sqlite3 spatialite-bin libsqlite3-mod-spatialite; sudo apt install -y openjdk-8-jre openjdk-8-jdk ant maven; sudo update-java-alternatives --set java-1.8.0-openjdk-amd64; export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::"); diff --git a/geonode/geoserver/helpers.py b/geonode/geoserver/helpers.py index f163ebf15ec..da8af89c5a9 100755 --- a/geonode/geoserver/helpers.py +++ b/geonode/geoserver/helpers.py @@ -1492,24 +1492,6 @@ def ensure_valid_configuration(self, alias): except KeyError: raise ServerDoesNotExist("The server %s doesn't exist" % alias) - datastore = server.get('DATASTORE') - uploader_backend = getattr( - settings, - 'UPLOADER', - dict()).get( - 'BACKEND', - 'geonode.rest') - - if uploader_backend == 'geonode.importer' and datastore and not settings.DATABASES.get( - datastore): - raise ImproperlyConfigured( - 'The OGC_SERVER setting specifies a datastore ' - 'but no connection parameters are present.') - - if uploader_backend == 'geonode.importer' and not datastore: - raise ImproperlyConfigured( - 'The UPLOADER BACKEND is set to geonode.importer but no DATASTORE is specified.') - if 'PRINTNG_ENABLED' in server: raise ImproperlyConfigured("The PRINTNG_ENABLED setting has been removed, use 'PRINT_NG_ENABLED' instead.") diff --git a/geonode/settings.py b/geonode/settings.py index 56462e340a3..392d9cae870 100644 --- a/geonode/settings.py +++ b/geonode/settings.py @@ -100,7 +100,8 @@ # see https://docs.djangoproject.com/en/1.8/ref/contrib/gis/db-api/#module-django.contrib.gis.db.backends for # detailed list of supported backends and notes. _db_conf = dj_database_url.parse(DATABASE_URL, conn_max_age=600) -_db_conf.update({'TIMEOUT': 60}) +if 'spatialite' in DATABASE_URL: + SPATIALITE_LIBRARY_PATH = 'mod_spatialite.so' DATABASES = { 'default': _db_conf } @@ -549,7 +550,7 @@ MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' # Security stuff -SESSION_EXPIRED_CONTROL_ENABLED = ast.literal_eval(os.environ.get('SESSION_EXPIRED_CONTROL_ENABLED', 'False')) +SESSION_EXPIRED_CONTROL_ENABLED = ast.literal_eval(os.environ.get('SESSION_EXPIRED_CONTROL_ENABLED', 'True')) if SESSION_EXPIRED_CONTROL_ENABLED: # This middleware checks for ACCESS_TOKEN validity and if expired forces @@ -740,13 +741,13 @@ ) GEOSERVER_PUBLIC_PORT = os.getenv( - 'GEOSERVER_PUBLIC_PORT', 8000 + 'GEOSERVER_PUBLIC_PORT', 8080 ) -_default_public_location = '{}://{}:{}/gs/'.format( +_default_public_location = '{}://{}:{}/geoserver/'.format( GEOSERVER_PUBLIC_SCHEMA, GEOSERVER_PUBLIC_HOST, - GEOSERVER_PUBLIC_PORT) if GEOSERVER_PUBLIC_PORT else '{}://{}/gs/'.format(GEOSERVER_PUBLIC_SCHEMA, GEOSERVER_PUBLIC_HOST) + GEOSERVER_PUBLIC_PORT) if GEOSERVER_PUBLIC_PORT else '{}://{}/geoserver/'.format(GEOSERVER_PUBLIC_SCHEMA, GEOSERVER_PUBLIC_HOST) GEOSERVER_PUBLIC_LOCATION = os.getenv( 'GEOSERVER_PUBLIC_LOCATION', _default_public_location @@ -807,8 +808,7 @@ # Uploader Settings DATA_UPLOAD_MAX_NUMBER_FIELDS = 100000 UPLOADER = { - 'BACKEND': os.getenv('DEFAULT_BACKEND_UPLOADER', 'geonode.rest'), - # 'BACKEND': 'geonode.importer', + 'BACKEND': os.getenv('DEFAULT_BACKEND_UPLOADER', 'geonode.importer'), 'OPTIONS': { 'TIME_ENABLED': ast.literal_eval(os.getenv('TIME_ENABLED', 'False')), 'MOSAIC_ENABLED': ast.literal_eval(os.getenv('MOSAIC_ENABLED', 'False')), diff --git a/geonode/utils.py b/geonode/utils.py index 84c9e2e1a4d..b9cea847c6b 100755 --- a/geonode/utils.py +++ b/geonode/utils.py @@ -1279,15 +1279,16 @@ def request(self, url, method='GET', data=None, headers={}, stream=False, timeou valid_uname_pw = base64.b64encode( b"%s:%s" % (self.username, self.password)).decode("ascii") headers['Authorization'] = 'Basic {}'.format(valid_uname_pw) - try: - _u = user or get_user_model().objects.get(username=self.username) - access_token = get_or_create_token(_u) - if access_token and not access_token.is_expired(): - headers['Authorization'] = 'Bearer %s' % access_token.token - except BaseException: - tb = traceback.format_exc() - logger.debug(tb) - pass + if not connection.cursor().db.vendor in ('sqlite', 'sqlite3', 'spatialite',): + try: + _u = user or get_user_model().objects.get(username=self.username) + access_token = get_or_create_token(_u) + if access_token and not access_token.is_expired(): + headers['Authorization'] = 'Bearer %s' % access_token.token + except BaseException: + tb = traceback.format_exc() + logger.debug(tb) + pass response = None content = None