Ejemplo n.º 1
0
    def test_get_section_merely_calls_get_on_config_data_dict(self):
        orig_method = config.cfg.get

        def fake_get(section):
            self.assertEqual("f@k3", section)
            return {"this": "is", "so": "fake"}

        config.cfg.get = fake_get
        self.assertEqual({"this": "is", "so": "fake"},
                         config.get_section("f@k3"))
        config.cfg.get = orig_method
Ejemplo n.º 2
0
    def test_get_section_merely_calls_get_on_config_data_dict(self):
        orig_method = config.cfg.get

        def fake_get(section):
            self.assertEqual("f@k3", section)
            return {"this": "is", "so": "fake"}

        config.cfg.get = fake_get
        self.assertEqual({
            "this": "is",
            "so": "fake"
        }, config.get_section("f@k3"))
        config.cfg.get = orig_method
Ejemplo n.º 3
0
# OpenQuake 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.

import os
import getpass

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

from openquake.engine import config

DB_SECTION = config.get_section('dbserver')

INSTALLED_APPS = ('openquake.server.db',)

OQSERVER_ROOT = os.path.dirname(__file__)

DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASE_DIR = os.path.abspath(os.path.dirname(__file__))

TEMPLATE_CONTEXT_PROCESSORS += (
    'django.contrib.messages.context_processors.messages',
    'openquake.server.utils.oq_server_context_processor',
)

STATIC_URL = '/static/'
Ejemplo n.º 4
0
os.environ["DJANGO_SETTINGS_MODULE"] = "openquake.server.settings"

# just in the case that are you using oq-engine from sources
# with the rest of oq libraries installed into the system (or a
# virtual environment) you must set this environment variable
if os.environ.get("OQ_ENGINE_USE_SRCDIR"):
    sys.modules['openquake'].__dict__["__path__"].insert(
        0, os.path.join(os.path.dirname(__file__), "openquake"))

from openquake.engine import config

config.abort_if_no_config_available()

sys.path.insert(0, os.path.dirname(__file__))

amqp = config.get_section("amqp")

# RabbitMQ broker (default)
BROKER_URL = 'amqp://%(user)s:%(password)s@%(host)s:%(port)s/%(vhost)s' % \
             amqp
# Redis broker (works only on Trusty)
# BROKER_URL = 'redis://%(host)s:6379/0' % amqp

# BROKER_POOL_LIMIT enables a connections pool so Celery can reuse
# a single connection to RabbitMQ. Value 10 is the default from
# Celery 2.5 where this feature is enabled by default.
# Actually disabled because it's not stable in production.
# See https://bugs.launchpad.net/oq-engine/+bug/1250402
BROKER_POOL_LIMIT = None

# RabbitMQ result backend (default)
Ejemplo n.º 5
0
import sys

os.environ["OQ_DISTRIBUTE"] = "celery"

# just in the case that are you using oq-engine from sources
# with the rest of oq libraries installed into the system (or a
# virtual environment) you must set this environment variable
if os.environ.get("OQ_ENGINE_USE_SRCDIR"):
    sys.modules['openquake'].__dict__["__path__"].insert(
        0, os.path.join(os.path.dirname(__file__), "openquake"))

from openquake.engine import config

config.abort_if_no_config_available()

amqp = config.get_section("amqp")

# RabbitMQ broker (default)
BROKER_URL = 'amqp://%(user)s:%(password)s@%(host)s:%(port)s/%(vhost)s' % \
             amqp
# Redis broker (works only on Trusty)
# BROKER_URL = 'redis://%(host)s:6379/0' % amqp

# BROKER_POOL_LIMIT enables a connections pool so Celery can reuse
# a single connection to RabbitMQ. Value 10 is the default from
# Celery 2.5 where this feature is enabled by default.
# Actually disabled because it's not stable in production.
# See https://bugs.launchpad.net/oq-engine/+bug/1250402
BROKER_POOL_LIMIT = None

# RabbitMQ result backend (default)
Ejemplo n.º 6
0
# OpenQuake 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.

import os
import getpass

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

from openquake.engine import config

DB_SECTION = config.get_section('dbserver')

INSTALLED_APPS = ('openquake.server.db', )

OQSERVER_ROOT = os.path.dirname(__file__)

DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASE_DIR = os.path.abspath(os.path.dirname(__file__))

TEMPLATE_CONTEXT_PROCESSORS += (
    'django.contrib.messages.context_processors.messages',
    'openquake.server.utils.oq_server_context_processor',
)

STATIC_URL = '/static/'
Ejemplo n.º 7
0
#
# OpenQuake 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.

import os

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

from openquake.engine import config

DB_SECTION = config.get_section('database')

INSTALLED_APPS = ('openquake.server.db',)

OQSERVER_ROOT = os.path.dirname(__file__)

DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASE_DIR = os.path.abspath(os.path.dirname(__file__))

TEMPLATE_CONTEXT_PROCESSORS += (
    'django.contrib.messages.context_processors.messages',
    'openquake.server.utils.oq_server_context_processor',
)

STATIC_URL = '/static/'