Exemplo n.º 1
0
"""
Dynamic settings file for site customization.
"""

from core.utils.configparser import Custom_ConfigParser
config = Custom_ConfigParser()
config.read('/etc/numeter/numeter_webapp.cfg')

import os
BASEDIR = os.path.dirname(os.path.abspath(__file__))

# Use a file to get SECRET_KEY
SECRET_KEY_FILE = config.get_d('global', 'secret_key_file',
                               '/etc/numeter/secret_key.txt')
with open(SECRET_KEY_FILE, 'r') as f:
    SECRET_KEY = f.read().strip()

DEBUG = config.getboolean_d('debug', 'debug', False)
TEMPLATE_DEBUG = DEBUG

ADMINS = config.getobj_d('global', 'admins')
MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': config.get('database', 'engine'),
        'NAME': config.get('database', 'name'),
        'USER': config.get_d('database', 'user', ''),
        'PASSWORD': config.get_d('database', 'password', ''),
        'HOST': config.get_d('database', 'host', ''),
        'PORT': config.get_d('database', 'port', ''),
Exemplo n.º 2
0
DATABASES = {
  'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': '/tmp/test_numeter.sqlite',
    'USER': '',
    'PASSWORD': '',
    'HOST': '',
    'PORT': '',
  }
}

# Use it as below
# Storage.objects.create(**settings.TEST_STORAGE)
TEST_STORAGES = []
if config.get_d('test', 'storage1_address', False):
    TEST_STORAGES.append({
      'name': 'Test Storage 1',
      'address': config.get_d('test', 'storage1_address', 'localhost'),
      'port': config.get_d('test', 'storage1_port', 8080),
      'url_prefix': config.get_d('test', 'storage1_url_prefix', '/numeter-storage'),
      'login': config.get_d('test', 'storage1_login', None),
      'password': config.get_d('test', 'storage1_password', None)
    })
if config.get_d('test', 'storage2_address', False):
    TEST_STORAGES.append({
      'name': 'Test Storage 2',
      'address': config.get_d('test', 'storage2_address', 'localhost'),
      'port': config.get_d('test', 'storage2_port', 8080),
      'url_prefix': config.get_d('test', 'storage2_url_prefix', '/numeter-storage'),
      'login': config.get_d('test', 'storage2_login', None),
Exemplo n.º 3
0
"""
Dynamic settings file for site customization.
"""

from core.utils.configparser import Custom_ConfigParser
config = Custom_ConfigParser()
config.read('/etc/numeter/numeter_webapp.cfg')

import os
BASEDIR = os.path.dirname(os.path.abspath(__file__))

# Use a file to get SECRET_KEY
SECRET_KEY_FILE = config.get_d('global', 'secret_key_file', '/etc/numeter/secret_key.txt')
with open(SECRET_KEY_FILE, 'r') as f:
    SECRET_KEY = f.read().strip()

DEBUG = config.getboolean_d('debug', 'debug', False)
TEMPLATE_DEBUG = DEBUG

ADMINS = config.getobj_d('global', 'admins')
MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': config.get('database', 'engine'),
        'NAME': config.get('database', 'name'),
        'USER': config.get_d('database', 'user', ''),
        'PASSWORD': config.get_d('database', 'password', ''),
        'HOST': config.get_d('database', 'host', ''),
        'PORT': config.get_d('database', 'port', ''),
    }