示例#1
0
from .apps import *  # noqa

from django.template.defaultfilters import slugify

from pombola.config import config
from pombola.core.logging_filters import skip_unreadable_post
from pombola.hansard.constants import NAME_SET_INTERSECTION_MATCH

IN_TEST_MODE = False

# Work out where we are to set up the paths correctly and load config
base_dir = os.path.abspath(os.path.join(
    os.path.split(__file__)[0], '..', '..'))
root_dir = os.path.abspath(os.path.join(base_dir, '..'))

if int(config.get('STAGING')):
    STAGING = True
else:
    STAGING = False

# switch on all debug when staging
DEBUG = STAGING

template_loaders = [
    'django.template.loaders.app_directories.Loader',
    'django.template.loaders.filesystem.Loader',
    # 'django.template.loaders.eggs.Loader',
]

if not STAGING:
    template_loaders = [(
import os
import yaml

from pombola.config import config

from .base import *  # noqa
from .ghana_base import *  # noqa


if config.get('EMAIL_SETTINGS', None):
    EMAIL_HOST = config.get('EMAIL_HOST', '')
    EMAIL_HOST_USER = config.get('EMAIL_HOST_USER', '')
    EMAIL_HOST_PASSWORD = config.get('EMAIL_HOST_PASSWORD', '')
    port = config.get('EMAIL_PORT', None)
    if port:
        EMAIL_PORT = port
    EMAIL_USE_TLS = config.get('EMAIL_USE_TLS', False)


INSTALLED_APPS = insert_after(INSTALLED_APPS,
                              'markitup',
                              'pombola.' + COUNTRY_APP)

INSTALLED_APPS += OPTIONAL_APPS

ENABLED_FEATURES = make_enabled_features(INSTALLED_APPS, ALL_OPTIONAL_APPS)

PIPELINE_CSS.update(COUNTRY_CSS)
PIPELINE_JS.update(COUNTRY_JS)

#need this for funky reversematch error in prod
示例#3
0
    },
    'select2-matchers': {
        'source_filenames': ('js/select2-optgroup-matcher.js', ),
        'output_filename': 'select2-matchers',
    },
    'facebook-experiment': {
        'source_filenames': (
            'js/select2-optgroup-matcher.js',
            'js/facebook-experiment.js',
        ),
        'output_filename':
        'js/facebook-experiment.js',
    },
    'collapse-responsibilities': {
        'source_filenames': ('js/collapse-responsibilities.js', ),
        'output_filename': 'js/collapse-responsibilities.js',
    },
    'lazy-loaded-images': {
        'source_filenames': (
            'js/libs/blazy.js',
            'js/lazy-loaded-images.js',
        ),
        'output_filename': 'js/lazy-loaded-images.js',
    },
}

HANSARD_NAME_MATCHING_ALGORITHM = NAME_SUBSTRING_MATCH

SURVEYGIZMO_API_TOKEN = config.get('SURVEYGIZMO_API_TOKEN')
SURVEYGIZMO_API_SECRET = config.get('SURVEYGIZMO_API_SECRET')
示例#4
0
文件: ghana.py 项目: leoouma/pombola
import os
import yaml

from pombola.config import config

from .base import *  # noqa
from .ghana_base import *  # noqa

if config.get('EMAIL_SETTINGS', None):
    EMAIL_HOST = config.get('EMAIL_HOST', '')
    EMAIL_HOST_USER = config.get('EMAIL_HOST_USER', '')
    EMAIL_HOST_PASSWORD = config.get('EMAIL_HOST_PASSWORD', '')
    port = config.get('EMAIL_PORT', None)
    if port:
        EMAIL_PORT = port
    EMAIL_USE_TLS = config.get('EMAIL_USE_TLS', False)

INSTALLED_APPS = insert_after(INSTALLED_APPS, 'markitup',
                              'pombola.' + COUNTRY_APP)

INSTALLED_APPS += OPTIONAL_APPS

ENABLED_FEATURES = make_enabled_features(INSTALLED_APPS, ALL_OPTIONAL_APPS)

PIPELINE_CSS.update(COUNTRY_CSS)
PIPELINE_JS.update(COUNTRY_JS)

#need this for funky reversematch error in prod
DEBUG_TOOLBAR_PATCH_SETTINGS = False
示例#5
0
def get_country():
    return config.get('COUNTRY_APP', 'no_country')
示例#6
0
import sys

# Add the path to the project root manually here. Ideally it could be added via
# python-path in the httpd.conf WSGI config, but I'm not changing that due to
# the large number of sites running under that config (although it shouldn't
# make a difference, as we just be duplicating the entry for older code that
# does not have this change in).
file_dir = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
sys.path.insert(
    0, # insert at the very start
    os.path.normpath(file_dir + "/..")
)

from pombola.config import config, config_path

if int(config.get('STAGING')) and sys.argv[1:2] != ['runserver']:
    import pombola.wsgi_monitor
    pombola.wsgi_monitor.start(interval=1.0)
    if config_path:
        pombola.wsgi_monitor.track(config_path)

country = config.get('COUNTRY_APP', 'no_country')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pombola.settings." + country)

gems_directory = config.get('GEMS_DIRECTORY')
if gems_directory:
    if os.path.exists(gems_directory):
        # If there's a gems directory in the virtualenv, set the GEM_HOME
        # and PATH so that django-pipeline can use compass from there:
        os.environ['GEM_HOME'] = gems_directory
from .apps import *  # noqa

from django.template.defaultfilters import slugify

from pombola.config import config
from pombola.core.logging_filters import skip_unreadable_post
from pombola.hansard.constants import NAME_SET_INTERSECTION_MATCH

IN_TEST_MODE = False

# Work out where we are to set up the paths correctly and load config
base_dir = os.path.abspath( os.path.join( os.path.split(__file__)[0], '..', '..' ) )
root_dir = os.path.abspath( os.path.join( base_dir, '..' ) )

if int(config.get('STAGING')):
    STAGING = True
else:
    STAGING = False

# switch on all debug when staging
DEBUG          = STAGING
TEMPLATE_DEBUG = STAGING

ADMINS = (
    (config.get('ERRORS_NAME'), config.get('ERRORS_EMAIL')),
)

SLUGGABLE_SLUGIFY_FUNCTION = slugify

DEFAULT_FROM_EMAIL = config.get('FROM_EMAIL')
示例#8
0
    },
}

COUNTRY_JS = {
    'experiments': {
        'source_filenames': (
            'js/click-tracking.js',
            'js/riveted.js',
        ),
        'output_filename': 'js/experiments.js',
    },
    'select2-matchers': {
        'source_filenames': (
            'js/select2-optgroup-matcher.js',
        ),
        'output_filename': 'select2-matchers',
    },
    'facebook-experiment': {
        'source_filenames': (
            'js/select2-optgroup-matcher.js',
            'js/facebook-experiment.js',
        ),
        'output_filename': 'js/facebook-experiment.js',
    },
}

HANSARD_NAME_MATCHING_ALGORITHM = NAME_SUBSTRING_MATCH

SURVEYGIZMO_API_TOKEN = config.get('SURVEYGIZMO_API_TOKEN')
SURVEYGIZMO_API_SECRET = config.get('SURVEYGIZMO_API_SECRET')
示例#9
0
import os
import shutil
from pombola.config import config

IN_TEST_MODE = True

base_dir = os.path.abspath(os.path.join(
    os.path.split(__file__)[0], '..', '..'))
# Change the data dir in testing, and delete it to ensure that we have a clean
# slate. Also print out a little warning - adds clutter to the test output but
# better than letting a site go live and not notice that the test mode has been
# detected by mistake
conf_data_dir = config.get('DATA_DIR', 'data')
if os.path.isabs(conf_data_dir):
    data_dir = os.path.join(conf_data_dir, 'testing')
else:
    data_dir = os.path.abspath(os.path.join(base_dir, conf_data_dir,
                                            'testing'))

if os.path.exists(data_dir):
    shutil.rmtree(data_dir)

print("Running in test mode! (testing data_dir is '%s')" % data_dir)

# For tests we've change the value of data_dir, so have to reset
# these settings variables:

MEDIA_ROOT = os.path.normpath(os.path.join(data_dir, "media_root/"))
STATIC_ROOT = os.path.normpath(os.path.join(data_dir, "collected_static/"))
HTTPLIB2_CACHE_DIR = os.path.join(data_dir, 'httplib2_cache')
HANSARD_CACHE = os.path.join(data_dir, 'hansard_cache')