Exemple #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
Exemple #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
Exemple #3
0
# (at your option) any later version.
#
# 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 openquake.commonlib import config

DB_SECTION = config.get_section('dbserver')

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

OQSERVER_ROOT = os.path.dirname(__file__)

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

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
Exemple #4
0
        pass  # don't set OQ_DISTRIBUTE
    else:
        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.commonlib 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

    # AMQP result backend (default)
Exemple #5
0
        pass  # don't set OQ_DISTRIBUTE
    else:
        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.commonlib 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

    # AMQP result backend (default)
Exemple #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.commonlib 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/'