From 68af678723d0acf2c2961d279a8c02b397d8abc1 Mon Sep 17 00:00:00 2001 From: Rizky Maulana Nugraha Date: Wed, 29 Jun 2016 17:42:06 +0700 Subject: [PATCH] Initial migration commit: Add readme --- .gitignore | 94 ++++++++++++++++++++++++++++++++++++++++ README.md | 19 ++++++++ local_settings.sample.py | 48 ++++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 local_settings.sample.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63095fa --- /dev/null +++ b/.gitignore @@ -0,0 +1,94 @@ +# Created by .ignore support plugin (hsz.mobi) +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# IPython Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# dotenv +.env + +# virtualenv +venv/ +ENV/ + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject + +# pycharm +.idea diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b523ff --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Geosafe App for Geonode + +Geosafe is a django app that integrates InaSAFE Headless functionality into +Geonode. This app adds new page that enabled user to: + +- Add InaSAFE based layer (Layer that contains InaSAFE keywords) +- Create InaSAFE Analysis +- Produce InaSAFE Analysis Reports + +Go to **Analysis** page to use this functionality + +# Setup + +Add this package as django app in your geonode installations. +You have to override specific configuration to integrate InaSAFE Headless to +this app. A sample settings can be seen in *local_settings.sample.py*. This +settings file should be included in geonode settings file or called last, to +make sure it was overriding celery settings in the default geonode settings. + diff --git a/local_settings.sample.py b/local_settings.sample.py new file mode 100644 index 0000000..0ae4086 --- /dev/null +++ b/local_settings.sample.py @@ -0,0 +1,48 @@ +import os +import djcelery +from kombu import Queue +from celery.schedules import crontab + +# App specific +# Geosafe - Celery settings + +# Pick the correct broker for relaying commands to InaSAFE Headless +BROKER_URL = 'redis://localhost:6379/0' +CELERY_RESULT_BACKEND = BROKER_URL + +# Specific celery settings. Can be modified accordingly or leave as default +CELERY_ALWAYS_EAGER = False +CELERY_EAGER_PROPAGATES_EXCEPTIONS = True +CELERY_IGNORE_RESULT = False +CELERY_SEND_EVENTS = True +CELERY_TASK_RESULT_EXPIRES = 24 * 3600 +CELERY_DISABLE_RATE_LIMITS = True +CELERY_DEFAULT_QUEUE = "default" +CELERY_DEFAULT_EXCHANGE = "default" +CELERY_DEFAULT_EXCHANGE_TYPE = "direct" +CELERY_DEFAULT_ROUTING_KEY = "default" +CELERY_CREATE_MISSING_QUEUES = True + +# Defining Celery queue to avoid clash between tasks. Leave as default +CELERY_QUEUES = [ + Queue('default', routing_key='default'), + Queue('cleanup', routing_key='cleanup'), + Queue('update', routing_key='update'), + Queue('email', routing_key='email'), + Queue('inasafe-headless', routing_key='inasafe-headless'), + Queue('geosafe', routing_key='geosafe'), +] + +# Schedule for periodic tasks +CELERYBEAT_SCHEDULE = { + # executes every night at 0:0 AM + 'clean-impact-nightly': { + 'task': 'geosafe.tasks.analysis.clean_impact_result', + 'schedule': crontab(hour='0', minute='0') + } +} + +djcelery.setup_loader() + +# base url used to resolve layer files accessed by InaSAFE Headless +GEONODE_BASE_URL = 'http://localhost:8000/'