diff --git a/.gitignore b/.gitignore index 0fcf136..2b00092 100644 --- a/.gitignore +++ b/.gitignore @@ -97,4 +97,5 @@ django_project/celerybeat-schedule # local media django_project/media # OSX Crap -deployment/backups \ No newline at end of file +deployment/backups +deployment/data_dir \ No newline at end of file diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 4b300eb..66d485e 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -54,7 +54,7 @@ uwsgi-base: - DJANGO_SETTINGS_MODULE=core.settings.prod_docker - VIRTUAL_HOST=haitidata.com - VIRTUAL_PORT=8080 - - GEOSERVER_PUBLIC_LOCATION=http://0.0.0.0:33300/api/geoserver/ + - SITEURL = http://localhost:33303/ # Set your locale - you need to ensure this is created in Dockerfile too... - LC_ALL=en_ZA.UTF-8 volumes: @@ -141,11 +141,11 @@ devweb: - DATABASE_PASSWORD=docker - DATABASE_HOST=db - RABBITMQ_HOST=rabbitmq - - DJANGO_SETTINGS_MODULE=core.settings.prod_docker + - DJANGO_SETTINGS_MODULE=core.settings.dev_docker - PYTHONPATH=/home/web/django_project + - SITEURL = http://localhost:33303/ - VIRTUAL_HOST=haitidata.com - VIRTUAL_PORT=8080 - - GEOSERVER_PUBLIC_LOCATION=http://0.0.0.0:33303/api/geoserver/ volumes: - ../django_project:/home/web/django_project - ./static:/home/web/static diff --git a/deployment/docker/Dockerfile b/deployment/docker/Dockerfile index 0f87b64..c78a3a6 100644 --- a/deployment/docker/Dockerfile +++ b/deployment/docker/Dockerfile @@ -1,7 +1,7 @@ #--------- Generic stuff all our Dockerfiles should start with so we get caching ------------ # Note this base image is based on debian FROM kartoza/django-base -MAINTAINER Muhammad Anis +MAINTAINER Irwan Fathurrahman #RUN ln -s /bin/true /sbin/initctl @@ -32,21 +32,8 @@ ENV TEST a ADD REQUIREMENTS.txt /REQUIREMENTS.txt RUN pip install -r /REQUIREMENTS.txt -RUN pip uninstall -y South RUN pip install uwsgi -RUN pip uninstall geonode-dialogos -y -RUN pip install git+https://github.com/meomancer/geonode-dialogos.git - -RUN pip uninstall geonode-agon-ratings -y -RUN pip install git+https://github.com/euclidian/custom-agon-ratings - -RUN pip uninstall Django -y -RUN pip install Django==1.8.18 - -RUN pip uninstall django-oauth-toolkit -y -RUN pip install django-oauth-toolkit==0.12.0 - RUN pip uninstall django-user-accounts -y RUN pip install git+https://github.com/GeoNode/geonode-user-accounts@invite-user diff --git a/deployment/docker/REQUIREMENTS.txt b/deployment/docker/REQUIREMENTS.txt index df07c78..7e35a95 100644 --- a/deployment/docker/REQUIREMENTS.txt +++ b/deployment/docker/REQUIREMENTS.txt @@ -1,42 +1,9 @@ -celery==3.1 -Django==1.10 -psycopg2 -django-compressor -icalendar==3.0.1b2 -geopy==0.95.1 -filebrowser-safe==0.4.5 -# https://github.com/getsentry/raven-python/issues/337 -raven==5.8.1 -django-sentry==1.13.5 -requests==2.13.0 - -#cartridge requirement -cartridge==0.12.0 - - -django-appconf==1.0.1 -django-model-utils==2.3.1 -django-reversion==1.9.3 -django-sitetree==1.5.1 -django-taggit==0.21.5 -django-timezone-field==1.3 -django-user-accounts==1.2.0 -easy-thumbnails==2.2 -html5lib==0.999999999 -markdown==2.6.2 -pytz==2015.6 -pyyaml==3.11 -ruamel.yaml==0.13.14 -bleach==2.0.0 - - -#geonode -django-geonode-client git+https://github.com/GeoNode/django-osgeo-importer.git -django-jsonfield - -python-dateutil gdal==1.10.0 -git+https://github.com/meomancer/GeoNode-1.git -django-tastypie +geonode==2.7 +django-compressor +django-geonode-client +django-user-accounts==2.0.2 +django-tastypie==0.13.0 +OWSLib==0.14 diff --git a/django_project/core/settings/base.py b/django_project/core/settings/base.py index cd4144e..dc8bc24 100644 --- a/django_project/core/settings/base.py +++ b/django_project/core/settings/base.py @@ -1,34 +1,8 @@ -# -*- coding: utf-8 -*- -######################################################################### -# -# Copyright (C) 2012 OpenPlans -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -######################################################################### - -# Django settings for the GeoNode project. -from __future__ import absolute_import, unicode_literals import os +from .secret import * +from geonode.settings import * # Django settings for the GeoNode project. from .utils import absolute_path -# This throws error -# from geonode.settings import * -# -# General Django development settings -# - # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. @@ -81,10 +55,7 @@ STATIC_URL = '/static/' SYMPOSION_STATIC_URL = "/site_media/" # Additional locations of static files -STATICFILES_DIRS = ( - # Put strings here, like "/home/html/static" or "C:/www/django/static". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. +STATICFILES_DIRS += ( absolute_path('core', 'base_static'), absolute_path('core', 'geonode_static'), ) @@ -133,7 +104,8 @@ TEMPLATES = [ "django.core.context_processors.media", "django.core.context_processors.request", "django.core.context_processors.tz", - "geonode.context_processors.resource_urls", + 'account.context_processors.account', + 'geonode.context_processors.resource_urls', "geonode.geoserver.context_processors.geoserver_urls", ], }, @@ -156,47 +128,6 @@ ROOT_URLCONF = 'core.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'core.wsgi.application' -INSTALLED_APPS = ( - "modeltranslation", - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.redirects", - "django.contrib.sessions", - "django.contrib.sites", - "django.contrib.sitemaps", - "django.contrib.staticfiles", -) - -# A sample logging configuration. The only tangible logging -# performed by this configuration is to send an email to -# the site admins on every HTTP 500 error when DEBUG=False. -# See http://docs.djangoproject.com/en/dev/topics/logging for -# more details on how to customize your logging configuration. -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse' - } - }, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'filters': ['require_debug_false'], - 'class': 'django.utils.log.AdminEmailHandler' - } - }, - 'loggers': { - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - } -} - SITENAME = 'haitidata' # Defines the directory that contains the settings file as the LOCAL_ROOT @@ -204,45 +135,32 @@ SITENAME = 'haitidata' LOCAL_ROOT = os.path.abspath(os.path.dirname(__file__)) LOCAL_MEDIA_URL = LOCAL_ROOT AVATAR_PATH_HANDLER = LOCAL_ROOT - - -# Load more settings from a file called local_settings.py if it exists -try: - from local_settings import * -except ImportError: - pass - - - -# INSTALLED_APPS = INSTALLED_APPS + ('osgeo_importer', 'geonode-client', 'wfs_harvest') - LAYER_PREVIEW_LIBRARY = 'react' IMPORT_HANDLERS = [ - # If GeoServer handlers are enabled, you must have an instance of geoserver running. - # Warning: the order of the handlers here matters. - 'osgeo_importer.handlers.FieldConverterHandler', - 'osgeo_importer.handlers.geoserver.GeoserverPublishHandler', - 'osgeo_importer.handlers.geoserver.GeoserverPublishCoverageHandler', - 'osgeo_importer.handlers.geoserver.GeoServerTimeHandler', - 'osgeo_importer.handlers.geoserver.GeoWebCacheHandler', - 'osgeo_importer.handlers.geoserver.GeoServerBoundsHandler', - 'osgeo_importer.handlers.geoserver.GenericSLDHandler', - 'osgeo_importer.handlers.geonode.GeoNodePublishHandler', - 'osgeo_importer.handlers.mapproxy.publish_handler.MapProxyGPKGTilePublishHandler', - 'osgeo_importer.handlers.geoserver.GeoServerStyleHandler', - 'osgeo_importer.handlers.geonode.GeoNodeMetadataHandler' - ] + # If GeoServer handlers are enabled, you must have an instance of geoserver running. + # Warning: the order of the handlers here matters. + 'osgeo_importer.handlers.FieldConverterHandler', + 'osgeo_importer.handlers.geoserver.GeoserverPublishHandler', + 'osgeo_importer.handlers.geoserver.GeoserverPublishCoverageHandler', + 'osgeo_importer.handlers.geoserver.GeoServerTimeHandler', + 'osgeo_importer.handlers.geoserver.GeoWebCacheHandler', + 'osgeo_importer.handlers.geoserver.GeoServerBoundsHandler', + 'osgeo_importer.handlers.geoserver.GenericSLDHandler', + 'osgeo_importer.handlers.geonode.GeoNodePublishHandler', + 'osgeo_importer.handlers.mapproxy.publish_handler.MapProxyGPKGTilePublishHandler', + 'osgeo_importer.handlers.geoserver.GeoServerStyleHandler', + 'osgeo_importer.handlers.geonode.GeoNodeMetadataHandler' +] OSGEO_DATASTORE = 'datastore' OSGEO_IMPORTER_GEONODE_ENABLED = True OSGEO_IMPORTER_VALID_EXTENSIONS = [ 'shp', 'shx', 'prj', 'dbf', 'kml', 'geojson', 'json', 'tif', 'tiff', 'gpkg', 'csv', 'zip', 'xml', 'sld' - ] +] - -#DATABASE_ROUTERS = ['{{app_name}}.dbrouters.DefaultOnlyMigrations'] +# DATABASE_ROUTERS = ['{{app_name}}.dbrouters.DefaultOnlyMigrations'] # # === MapProxy settings # # This is the location to place additional configuration files for mapproxy to work from. @@ -255,8 +173,8 @@ MAPPROXY_CONFIG_FILENAME = 'geonode.yaml' # set as '_' (by conf_from_geopackage()). MAPPROXY_SERVER_LOCATION = 'http://localhost:8088/geonode/tms/1.0.0/{layer_name}/{grid_name}/' -#import pyproj -#PROJECTION_DIRECTORY = os.path.join(os.path.dirname(pyproj.__file__), 'data/') +# import pyproj +# PROJECTION_DIRECTORY = os.path.join(os.path.dirname(pyproj.__file__), 'data/') PROJECTION_DIRECTORY = '/tmp/' try: @@ -264,30 +182,8 @@ try: except: CELERY_IMPORTS = ('osgeo_importer.tasks',) -LOCKDOWN_GEONODE = False - BROKER_URL = "amqp://guest@localhost:5672" CELERY_ALWAYS_EAGER = True IMPORT_TASK_SOFT_TIME_LIMIT = 90 MAX_CSV_RECORDS = 20000 -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -SOCIAL_ORIGINS = [{ - "label":"paper-plane-o", - "url":"mailto:?subject={name}&body={url}", - "css_class":"email" -}, { - "label":"facebook", - "url":"http://www.facebook.com/sharer.php?u={url}", - "css_class":"fb" -}, { - "label":"twitter", - "url":"https://twitter.com/share?url={url}&hashtags={hashtags}", - "css_class":"tw" -}, { - "label":"google-plus", - "url":"https://plus.google.com/share?url={url}", - "css_class":"gp" -}] diff --git a/django_project/core/settings/contrib.py b/django_project/core/settings/contrib.py deleted file mode 100644 index 1ee861b..0000000 --- a/django_project/core/settings/contrib.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding=utf-8 -""" -core.settings.contrib -""" -from .base import * # noqa -from distutils.util import strtobool -import os - -# Store these package names here as they may change in the future since -# at the moment we are using custom forks of them. -PACKAGE_NAME_FILEBROWSER = "filebrowser_safe" -PACKAGE_NAME_GRAPPELLI = "grappelli_safe" -GRAPPELLI_INSTALLED = True - -# Extra installed apps - grapelli needs to be added before others -INSTALLED_APPS += ( - "django_comments", - "compressor", - "avatar", - "osgeo_importer", - 'pagination', - 'taggit', - 'treebeard', - 'friendlytagloader', - 'geoexplorer', - 'leaflet', - 'django_extensions', - 'autocomplete_light', - 'mptt', - 'djcelery', - 'storages', - 'geonode-client', - - # Theme - "pinax_theme_bootstrap_account", - "pinax_theme_bootstrap", - 'django_forms_bootstrap', - - # Social - 'account', - 'dialogos', - 'agon_ratings', - # 'notification', - 'announcements', - 'actstream', - 'user_messages', - 'tastypie', - 'polymorphic', - 'guardian', - 'oauth2_provider', - -# GeoNode internal apps - 'geonode', - 'geonode.base', - 'geonode.maps', - 'geonode.people', - 'geonode.layers', - 'geonode.proxy', - 'geonode.security', - 'geonode.social', - 'geonode.catalogue', - 'geonode.documents', - 'geonode.api', - 'geonode.groups', - 'geonode.services', - - # QGIS Server Apps - # 'geonode_qgis_server', - - # GeoServer Apps - # Geoserver needs to come last because - # it's signals may rely on other apps' signals. - 'geonode.geoserver', - 'geonode.upload', - 'geonode.tasks', - -) - -MARKDOWNIFY_WHITELIST_TAGS = [ - 'a', - 'abbr', - 'acronym', - 'b', - 'blockquote', - 'em', - 'i', - 'li', - 'ol', - 'p', - 'strong', - 'ul' -] - -REGISTRATION_OPEN = True -ACCOUNT_OPEN_SIGNUP = True -ACCOUNT_EMAIL_UNIQUE = True -ACCOUNT_EMAIL_CONFIRMATION_REQUIRED = False -ACCOUNT_SIGNUP_REDIRECT_URL = "/" -ACCOUNT_LOGIN_REDIRECT_URL = "/" -ACCOUNT_LOGOUT_REDIRECT_URL = "home" -ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2 -ACCOUNT_USE_AUTH_AUTHENTICATE = True -HOOKSET = "pinaxcon_theme.hooks.Foss4GAccountHookset" -MODIFY_TOPICCATEGORY = False -EXTRA_LANG_INFO = [] - -LOCKDOWN_GEONODE = strtobool(os.getenv('LOCKDOWN_GEONODE', 'False')) - - -DEFAULT_WORKSPACE = os.getenv('DEFAULT_WORKSPACE', 'geonode') -CASCADE_WORKSPACE = os.getenv('CASCADE_WORKSPACE', 'geonode') -OGP_URL = os.getenv('OGP_URL', "http://geodata.tufts.edu/solr/select") - - -MISSING_THUMBNAIL = os.getenv( - 'MISSING_THUMBNAIL', 'geonode/img/missing_thumb.png' -) - -# Search Snippet Cache Time in Seconds -CACHE_TIME = int(os.getenv('CACHE_TIME', '0')) - -AUTH_USER_MODEL = os.getenv('AUTH_USER_MODEL', 'people.Profile') - -GEOSERVER_LOCATION = 'http://geoserver:8080/geoserver/' -GEOSERVER_PUBLIC_LOCATION = os.environ.get('GEOSERVER_PUBLIC_LOCATION','http://0.0.0.0:33300/api/geoserver/') - -OGC_SERVER = { - 'default': { - 'BACKEND': 'geonode.geoserver', - 'LOCATION': GEOSERVER_LOCATION, - 'LOGIN_ENDPOINT': 'j_spring_oauth2_geonode_login', - 'LOGOUT_ENDPOINT': 'j_spring_oauth2_geonode_logout', - # PUBLIC_LOCATION needs to be kept like this because in dev mode - # the proxy won't work and the integration tests will fail - # the entire block has to be overridden in the local_settings - 'PUBLIC_LOCATION': GEOSERVER_PUBLIC_LOCATION, - 'USER': 'admin', - 'PASSWORD': 'geoserver', - 'MAPFISH_PRINT_ENABLED': True, - 'PRINT_NG_ENABLED': True, - 'GEONODE_SECURITY_ENABLED': True, - 'GEOGIG_ENABLED': False, - 'WMST_ENABLED': False, - 'BACKEND_WRITE_ENABLED': True, - 'WPS_ENABLED': False, - # Set to name of database in DATABASES dictionary to enable - 'DATASTORE': '', # 'datastore', - 'PG_GEOGIG': False, - 'TIMEOUT': 10 # number of seconds to allow for HTTP requests - } -} - -ALLOWED_DOCUMENT_TYPES = ["pdf"] -MISSING_THUMBNAIL = os.getenv( - 'MISSING_THUMBNAIL', 'geonode/img/missing_thumb.png' -) -# Whether the uplaoded resources should be public and downloadable by default -# or not -DEFAULT_ANONYMOUS_VIEW_PERMISSION = strtobool( - os.getenv('DEFAULT_ANONYMOUS_VIEW_PERMISSION', 'True') -) -DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION = strtobool( - os.getenv('DEFAULT_ANONYMOUS_VIEW_PERMISSION', 'True') -) - -# Available download formats -DOWNLOAD_FORMATS_METADATA = [ - 'Atom', 'DIF', 'Dublin Core', 'ebRIM', 'FGDC', 'ISO', -] -DOWNLOAD_FORMATS_VECTOR = [ - 'JPEG', 'PDF', 'PNG', 'Zipped Shapefile', 'GML 2.0', 'GML 3.1.1', 'CSV', - 'Excel', 'GeoJSON', 'KML', 'View in Google Earth', 'Tiles', -] -DOWNLOAD_FORMATS_RASTER = [ - 'JPEG', - 'PDF', - 'PNG', - 'ArcGrid', - 'GeoTIFF', - 'Gtopo30', - 'ImageMosaic', - 'KML', - 'View in Google Earth', - 'Tiles', - 'GML', - 'GZIP' -] - -API_INCLUDE_REGIONS_COUNT = False -HAYSTACK_SEARCH = False -RESOURCE_PUBLISHING = True -SITEURL = os.getenv('SITEURL', "http://localhost:33300/") - -# Uploader Settings -UPLOADER = { - 'BACKEND': 'geonode.rest', - 'OPTIONS': { - 'TIME_ENABLED': False, - 'MOSAIC_ENABLED': False, - 'GEOGIG_ENABLED': False, - } -} - -# CSW settings -CATALOGUE = { - 'default': { - # The underlying CSW implementation - # default is pycsw in local mode (tied directly to GeoNode Django DB) - 'ENGINE': 'geonode.catalogue.backends.pycsw_local', - # pycsw in non-local mode - # 'ENGINE': 'geonode.catalogue.backends.pycsw_http', - # GeoNetwork opensource - # 'ENGINE': 'geonode.catalogue.backends.geonetwork', - # deegree and others - # 'ENGINE': 'geonode.catalogue.backends.generic', - - # The FULLY QUALIFIED base url to the CSW instance for this GeoNode - 'URL': '%scatalogue/csw' % SITEURL, - # 'URL': 'http://localhost:8080/geonetwork/srv/en/csw', - # 'URL': 'http://localhost:8080/deegree-csw-demo-3.0.4/services', - - # login credentials (for GeoNetwork) - # 'USER': 'admin', - # 'PASSWORD': 'admin', - } -} - -# pycsw settings -PYCSW = { - # pycsw configuration - 'CONFIGURATION': { - # uncomment / adjust to override server config system defaults - # 'server': { - # 'maxrecords': '10', - # 'pretty_print': 'true', - # 'federatedcatalogues': 'http://catalog.data.gov/csw' - # }, - 'metadata:main': { - 'identification_title': 'GeoNode Catalogue', - 'identification_abstract': 'GeoNode is an open source platform' \ - ' that facilitates the creation, sharing, and collaborative use' \ - ' of geospatial data', - 'identification_keywords': 'sdi, catalogue, discovery, metadata,' \ - ' GeoNode', - 'identification_keywords_type': 'theme', - 'identification_fees': 'None', - 'identification_accessconstraints': 'None', - 'provider_name': 'Organization Name', - 'provider_url': SITEURL, - 'contact_name': 'Lastname, Firstname', - 'contact_position': 'Position Title', - 'contact_address': 'Mailing Address', - 'contact_city': 'City', - 'contact_stateorprovince': 'Administrative Area', - 'contact_postalcode': 'Zip or Postal Code', - 'contact_country': 'Country', - 'contact_phone': '+xx-xxx-xxx-xxxx', - 'contact_fax': '+xx-xxx-xxx-xxxx', - 'contact_email': 'Email Address', - 'contact_url': 'Contact URL', - 'contact_hours': 'Hours of Service', - 'contact_instructions': 'During hours of service. Off on ' \ - 'weekends.', - 'contact_role': 'pointOfContact', - }, - 'metadata:inspire': { - 'enabled': 'true', - 'languages_supported': 'eng,gre', - 'default_language': 'eng', - 'date': 'YYYY-MM-DD', - 'gemet_keywords': 'Utility and governmental services', - 'conformity_service': 'notEvaluated', - 'contact_name': 'Organization Name', - 'contact_email': 'Email Address', - 'temp_extent': 'YYYY-MM-DD/YYYY-MM-DD', - } - } -} - -# GeoNode javascript client configuration - -# default map projection -# Note: If set to EPSG:4326, then only EPSG:4326 basemaps will work. -DEFAULT_MAP_CRS = "EPSG:900913" - -# Where should newly created maps be focused? -DEFAULT_MAP_CENTER = (0, 0) - -# How tightly zoomed should newly created maps be? -# 0 = entire world; -# maximum zoom is between 12 and 15 (for Google Maps, coverage varies by area) -DEFAULT_MAP_ZOOM = 0 - -ALT_OSM_BASEMAPS = os.environ.get('ALT_OSM_BASEMAPS', False) -CARTODB_BASEMAPS = os.environ.get('CARTODB_BASEMAPS', False) -STAMEN_BASEMAPS = os.environ.get('STAMEN_BASEMAPS', False) -THUNDERFOREST_BASEMAPS = os.environ.get('THUNDERFOREST_BASEMAPS', False) -MAPBOX_ACCESS_TOKEN = os.environ.get('MAPBOX_ACCESS_TOKEN', None) -BING_API_KEY = os.environ.get('BING_API_KEY', None) -CLIENT_RESULTS_LIMIT = 10 -THEME_ACCOUNT_CONTACT_EMAIL = "anis@kartoza.com" - -MAP_BASELAYERS = [{ - "source": {"ptype": "gxp_olsource", "url": GEOSERVER_PUBLIC_LOCATION + "wms"}, - "type": "OpenLayers.Layer", - "args": ["No background"], - "name": "background", - "visibility": False, - "fixed": True, - "group": "background" -}, { - "source": {"ptype": "gxp_osmsource"}, - "type": "OpenLayers.Layer.OSM", - "name": "mapnik", - "visibility": True, - "fixed": True, - "group": "background" -}] \ No newline at end of file diff --git a/django_project/core/settings/dev_docker.py b/django_project/core/settings/dev_docker.py index be36e6d..0902133 100644 --- a/django_project/core/settings/dev_docker.py +++ b/django_project/core/settings/dev_docker.py @@ -1,11 +1,15 @@ +__author__ = 'Irwan Fathurrahman ' +__date__ = '13/09/17' # -*- coding: utf-8 -*- """Settings for when running under docker in development mode.""" + +import os from .utils import ensure_secret_key_file + +DEBUG = True ensure_secret_key_file() from .dev import * # noqa -import os -print os.environ DATABASES = { 'default': { @@ -18,3 +22,5 @@ DATABASES = { 'TEST_NAME': 'unittests', } } + +print INSTALLED_APPS diff --git a/django_project/core/settings/prod_docker.py b/django_project/core/settings/prod_docker.py index ed2c9a8..40048cb 100644 --- a/django_project/core/settings/prod_docker.py +++ b/django_project/core/settings/prod_docker.py @@ -1,8 +1,8 @@ - """Configuration for production server""" # noinspection PyUnresolvedReferences from .prod import * # noqa import os + print os.environ DEBUG = False @@ -10,7 +10,7 @@ DEBUG = False ALLOWED_HOSTS = ['*'] ADMINS = ( - ('Muhammad Anis', 'anis@kartoza.com'),) + ('Irwan Fathurrahman', 'irwan@kartoza.com'),) DATABASES = { 'default': { @@ -24,7 +24,6 @@ DATABASES = { } } - # See fig.yml file for postfix container definition # EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' diff --git a/django_project/core/settings/project.py b/django_project/core/settings/project.py index 538e708..3c2add6 100644 --- a/django_project/core/settings/project.py +++ b/django_project/core/settings/project.py @@ -1,37 +1,54 @@ -# coding=utf-8 - -"""Project level settings. - -Adjust these values as needed but don't commit passwords etc. to any public -repository! -""" - -import os # noqa +from .base import * from django.utils.translation import ugettext_lazy as _ -from .contrib import * # noqa + + +PROJECTION_DIRECTORY = '/tmp/' + +GEOSERVER_BASE_URL = 'http://localhost:33308/geoserver/' +GEOSERVER_LOCATION = 'http://geoserver:8080/geoserver/' +GEOSERVER_PUBLIC_LOCATION = os.environ.get( + 'GEOSERVER_PUBLIC_LOCATION', + 'http://0.0.0.0:33300/api/geoserver/' +) + +OGC_SERVER = { + 'default': { + 'BACKEND': 'geonode.geoserver', + 'LOCATION': GEOSERVER_LOCATION, + 'LOGIN_ENDPOINT': 'j_spring_oauth2_geonode_login', + 'LOGOUT_ENDPOINT': 'j_spring_oauth2_geonode_logout', + # PUBLIC_LOCATION needs to be kept like this because in dev mode + # the proxy won't work and the integration tests will fail + # the entire block has to be overridden in the local_settings + 'PUBLIC_LOCATION': GEOSERVER_PUBLIC_LOCATION, + 'USER': 'admin', + 'PASSWORD': 'geoserver', + 'MAPFISH_PRINT_ENABLED': True, + 'PRINT_NG_ENABLED': True, + 'GEONODE_SECURITY_ENABLED': True, + 'GEOGIG_ENABLED': False, + 'WMST_ENABLED': False, + 'BACKEND_WRITE_ENABLED': True, + 'WPS_ENABLED': False, + # Set to name of database in DATABASES dictionary to enable + 'DATASTORE': '', # 'datastore', + 'PG_GEOGIG': False, + 'TIMEOUT': 10 # number of seconds to allow for HTTP requests + } +} # Project apps INSTALLED_APPS += ( + "django.contrib.redirects", + "osgeo_importer", + 'geonode-client', + # Add any additional project apps here "charts_app", "wfs_harvest", ) -THESAURI = [] - -# Due to profile page does not available, -# this will redirect to home page after login -LOGIN_REDIRECT_URL = '/' - -# How many versions to list in each project box -PROJECT_VERSION_LIST_SIZE = 10 - -# Set debug to false for production -DEBUG = TEMPLATE_DEBUG = True - -SOUTH_TESTS_MIGRATE = False - # Set languages which want to be translated LANGUAGES = ( ('en', _('English')), @@ -43,10 +60,6 @@ LANGUAGES = ( # Set storage path for the translation files LOCALE_PATHS = (absolute_path('locale'),) -MIDDLEWARE_CLASSES = ( - # Add any additional middleware classes here - ) + MIDDLEWARE_CLASSES - DATABASES = {} # default login url @@ -55,4 +68,20 @@ LOGIN_URL = '/account/login/' # maximum clip size in bytes MAXIMUM_CLIP_SIZE = '40000000' - +SOCIAL_ORIGINS = [{ + "label": "paper-plane-o", + "url": "mailto:?subject={name}&body={url}", + "css_class": "email" +}, { + "label": "facebook", + "url": "http://www.facebook.com/sharer.php?u={url}", + "css_class": "fb" +}, { + "label": "twitter", + "url": "https://twitter.com/share?url={url}&hashtags={hashtags}", + "css_class": "tw" +}, { + "label": "google-plus", + "url": "https://plus.google.com/share?url={url}", + "css_class": "gp" +}] diff --git a/django_project/core/settings/secret.py b/django_project/core/settings/secret.py index 451ad06..ae0b763 100644 --- a/django_project/core/settings/secret.py +++ b/django_project/core/settings/secret.py @@ -1,8 +1,8 @@ -SECRET_KEY = u'k*qrny^q$=60p%$5vx&qrty_*o*wn)s)5g9wom%-r+rjy+-4c&' -DISQUS_WEBSITE_SHORTNAME = u'p_k!6=)c6y)nak5^&0m*nywqm7(sd8-c-6t^6i&#af)64b5b8y' +SECRET_KEY = u'(!=y)ilhln$#md_c0@^!)#-8g*e15+4r9$ne1mmq%n_ukm#9be' +DISQUS_WEBSITE_SHORTNAME = u'-=x%t_l2po^(_&_*(x8@k6pn+e)^y0wj_)%iy7p@v9w74tgc2+' COMMENTS_DISQUS_API_SECRET_KEY = '' COMMENTS_DISQUS_API_PUBLIC_KEY = '' COMMENTS_DISQUS_SHORTNAME = '' SENTRY_DSN = '' -SOCIAL_AUTH_GITHUB_KEY = '8f650ca006d7d1674820' -SOCIAL_AUTH_GITHUB_SECRET = '8a4ad8ab6c3a9adecb7f10cf2d9229a4c44fc57e' +SOCIAL_AUTH_GITHUB_KEY = '' +SOCIAL_AUTH_GITHUB_SECRET = '' diff --git a/django_project/core/settings/test.py b/django_project/core/settings/test.py deleted file mode 100644 index ada4a1b..0000000 --- a/django_project/core/settings/test.py +++ /dev/null @@ -1,42 +0,0 @@ - -from .project import * # noqa - -# http://hustoknow.blogspot.com/2011/02/setting-up-django-nose-on-hudson.html -INSTALLED_APPS += ( - 'django_nose', # don't remove this comma -) - -TEST_RUNNER = 'django.test.runner.DiscoverRunner' - -NOSE_ARGS = ( - '--with-coverage', - '--cover-erase', - '--cover-html', - '--cover-html-dir=xmlrunner/html', - '--cover-inclusive', - # '--cover-package=django_app', - '--nocapture', - '--nologcapture' -) - - -EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' -# change this to a proper location -EMAIL_FILE_PATH = '/tmp/' - - -LOGGING = { - # internal dictConfig version - DON'T CHANGE - 'version': 1, - 'disable_existing_loggers': True, - 'handlers': { - 'nullhandler': { - 'class': 'logging.NullHandler', - }, - }, - # default root logger - 'root': { - 'level': 'DEBUG', - 'handlers': ['nullhandler'], - } -} diff --git a/django_project/core/settings/test_docker.py b/django_project/core/settings/test_docker.py deleted file mode 100644 index 0142f8b..0000000 --- a/django_project/core/settings/test_docker.py +++ /dev/null @@ -1,20 +0,0 @@ - -__author__ = 'rischan' - -# -*- coding: utf-8 -*- -from .test import * # noqa - -DATABASES = { - 'default': { - 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'test_db', - 'USER': 'docker', - 'PASSWORD': 'docker', - 'HOST': 'db', - # Set to empty string for default. - 'PORT': '', - } -} - -MEDIA_ROOT = '/tmp/media' -STATIC_ROOT = '/tmp/static' diff --git a/django_project/core/settings/test_travis.py b/django_project/core/settings/test_travis.py deleted file mode 100644 index 188e061..0000000 --- a/django_project/core/settings/test_travis.py +++ /dev/null @@ -1,22 +0,0 @@ - -__author__ = 'rischan' - -# -*- coding: utf-8 -*- -from .test import * # noqa - -STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage' - -DATABASES = { - 'default': { - 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'test_db', - 'USER': 'postgres', - 'PASSWORD': '', - 'HOST': 'localhost', - # Set to empty string for default. - 'PORT': '', - } -} - -MEDIA_ROOT = '/tmp/media' -STATIC_ROOT = '/tmp/static' diff --git a/django_project/core/urls.py b/django_project/core/urls.py index 912dcf7..9111ec9 100644 --- a/django_project/core/urls.py +++ b/django_project/core/urls.py @@ -6,7 +6,6 @@ from geonode.sitemap import LayerSitemap, MapSitemap from geonode.api.urls import api from geonode.api.views import verify_token, roles, users, admin_role - import autocomplete_light autocomplete_light.autodiscover() @@ -21,70 +20,17 @@ sitemaps = { "layer": LayerSitemap, "map": MapSitemap } +from osgeo_importer.urls import urlpatterns as importer_urlpatterns + +from geonode.urls import * urlpatterns = i18n_patterns( - url(r'^$', TemplateView.as_view(template_name="site_index.html"), name='home'), - url(r'^help/$', TemplateView.as_view(template_name='help.html'), name='help'), - url(r'^developer/$', TemplateView.as_view(template_name='developer.html'), name='developer'), - url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'), + '', + url(r'^/?$', TemplateView.as_view(template_name='site_index.html'), name='home'), + url(r'^', include('geonode.urls')), url(r'^chart/', include('charts_app.urls')), - url(r'^table/', include('wfs_harvest.urls')), - url(r'^layers/', include('geonode.layers.urls')), - - # Map views - url(r'^maps/', include('geonode.maps.urls')), - - # Catalogue views - url(r'^catalogue/', include('geonode.catalogue.urls')), - - # data.json - url(r'^data.json$', 'geonode.catalogue.views.data_json', name='data_json'), - - # ident - url(r'^ident.json$', 'geonode.views.ident_json', name='ident_json'), - - # h keywords - url(r'^h_keywords_api$', 'geonode.views.h_keywords', name='h_keywords_api'), - - # Search views - url(r'^search/$', TemplateView.as_view(template_name='search/search.html'), name='search'), - - # Social views - url(r"^account/", include("account.urls")), - url(r'^people/', include('geonode.people.urls')), - url(r'^avatar/', include('avatar.urls')), - url(r'^comments/', include('dialogos.urls')), - url(r'^ratings/', include('agon_ratings.urls')), - url(r'^activity/', include('actstream.urls')), - url(r'^announcements/', include('announcements.urls')), - url(r'^messages/', include('user_messages.urls')), - url(r'^social/', include('geonode.social.urls')), - url(r'^security/', include('geonode.security.urls')), - - # Accounts - url(r'^account/ajax_login$', 'geonode.views.ajax_login', name='account_ajax_login'), - url(r'^account/ajax_lookup$', 'geonode.views.ajax_lookup', name='account_ajax_lookup'), - - # Meta - url(r'^lang\.js$', TemplateView.as_view(template_name='lang.js', content_type='text/javascript'), - name='lang'), - - url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict, name='jscat'), - url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}, - name='sitemap'), - - url(r'^autocomplete/', include('autocomplete_light.urls')), - url(r'^admin/', include(admin.site.urls)), - url(r'^groups/', include('geonode.groups.urls')), - url(r'^documents/', include('geonode.documents.urls')), - url(r'^services/', include('geonode.services.urls')), - # OAuth Provider - url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), - - # Api Views - url(r'^api/o/v4/tokeninfo', verify_token, name='tokeninfo'), - url(r'^api/roles', roles, name='roles'), - url(r'^api/adminRole', admin_role, name='adminRole'), - url(r'^api/users', users, name='users'), - url(r'', include(api.urls)), + url(r'^table/', include('wfs_harvest.urls')) ) + +urlpatterns += importer_urlpatterns +urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)