コード例 #1
0
 def _get_ability_details(self, handler):
     docstring = str(inspect.getdoc(handler))
     match = self.ability_regex.search(docstring)
     err = ValueError("Unexpected docstring format: {}".format(docstring))
     if match is None:
         raise err
     try:
         config = match.group("config")
     except IndexError:
         raise err
     parser = configparser.SafeConfigParser({
         "name": None,
         "raise_exc": False
     })
     parser.readfp(six.StringIO(config))
     name = parser.get("config", "name")
     if name is None:
         raise ValueError("handler {} is missing the `name` attribute",
                          handler.__name__)
     return (
         name,
         {
             "raise_exc": parser.getboolean("config", "raise_exc"),
             "expect_payload": "payload"
             in inspect.getargspec(handler).args,
         },
     )
コード例 #2
0
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Access configparser to load variable values
from django.utils.six.moves import configparser
config = configparser.SafeConfigParser(allow_no_value=True)
config.read(os.path.join(BASE_DIR, 'setup', 'preprod_setting.cfg'))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config.get('security', 'SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config.getboolean('general', 'DEBUG')

ALLOWED_HOSTS = config.get('general', 'ALLOWED_HOSTS').split(",")

# Application definition
コード例 #3
0
ファイル: common.py プロジェクト: dtoakley/hearts-django
Generated by 'django-admin startproject' using Django 1.10.

For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""

import os
import sys

from django.utils.six.moves import configparser


config = configparser.SafeConfigParser(allow_no_value=True, interpolation=None)
config.read(os.getenv('HEARTS_ENV_CONFIG_FILE'))

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Adding the BASE_DIR to the system path. Not sure why this is necessary...
sys.path.append(BASE_DIR)

# Append apps directory to the system path so we don't need to
# explicitly use 'apps' in imports.
sys.path.append(os.path.join(BASE_DIR, "apps"))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/