1#! /usr/bin/env python
  2# -*- coding: utf-8 -*-
  3
  4"""Configuration for {{name}} project.
  5This file is based on a Django settings.py and contains many Django-specific settings.
  6It also includes project specific settings for projects re-using parts of CHART.
  7"""
  8
  9import os
 10import runpy
 11
 12from chart.common.path import Path
 13
 14# Project home directory
 15PROJ_HOME_DIR = Path(__file__).absolute().parent
 16
 17# Project root directory
 18PROJ_ROOT_DIR = PROJ_HOME_DIR.parent
 19
 20# Pull in project settings (must come after all core settings)
 21import runpy
 22globals().update(runpy.run_module('chart.core_settings', init_globals=globals()))
 23
 24
 25#
 26#
 27##
 28###
 29### Basic settings
 30###
 31##
 32#
 33#
 34
 35__version__ = '0.1'
 36
 37# APPNAME string is shown in the website
 38APPNAME = '{{appname}}'
 39
 40#
 41#
 42##
 43###
 44#### Email configuration
 45###
 46##
 47#
 48#
 49
 50# use instance settings to override these
 51DEBUG = False
 52
 53#
 54#
 55##
 56###
 57#### Database configuration
 58###
 59##
 60#
 61#
 62
 63<<<hidden due to potential security issue>>>
 64
 65DATABASES.update({
 66    'sqlite': {
 67        'DESCRIPTION': 'Local test database',
 68        'ENGINE': 'django.db.backends.sqlite3',
 69        'NAME': PROJ_ROOT_DIR.child('sqlite.db'),
 70        },
 71    })
 72
 73# Maximum length of spacecraft IDs
 74SID_CLASS = '{{sid}}'
 75
 76# default database name for the project
 77DB_NAME = 'sqlite'
 78
 79#
 80#
 81##
 82###
 83#### Django website configuration
 84###
 85##
 86#
 87#
 88
 89# unless there is a local override, show templates in release mode
 90TEMPLATE_DEBUG = False
 91
 92# Location of top level urls.py
 93ROOT_URLCONF = '{{name}}.urls'
 94
 95# add addition project directories which include Django templates
 96TEMPLATE_DIRS += [
 97    PROJ_HOME_DIR.child('homepage', 'templates'),
 98    ]
 99
100# add addition project directories which include Django urls.py files
101INSTALLED_APPS += ['myproj.homepage',  # to get the index and system pages
102                  # 'myproj.widgets',  # so staticfiles picks up thumbnails for project widgets
103                  ]
104
105#
106#
107##
108###
109#### Plot tool configuration
110###
111##
112#
113#
114
115# Used by plot and event viewer tools
116DEFAULT_SCID = 'M01'
117
118# Default statistics type for generating fast long term plots
119DEFAULT_STATS_TYPE = 'ORB'
120DEFAULT_STATS_NAME = 'Orbital'
121
122REGION_TYPES = ('orbit', )
123
124
125# A dictionary of stats names used for plots against corresponding stats types
126# (which are also the names of REGION fields in DB stats tables)
127
128PLOT_SUBSAMPLING = [
129    {'value': 'AUTO', 'option': 'Auto',
130     'title': 'All-points or stats averages according to data size and screen width'},
131    {'value': 'AP', 'option': 'All points', 'title': 'Show all points'},
132    {'value': 'FIT', 'option': 'All points, subsampled', 'title': 'Subsample to fit plot width'},
133    {'value': 'ORB', 'option': 'Orbital', 'title': 'Orbital'},
134    #{'value': 'HOUR', 'option': 'Hourly', 'title': 'Hourly'},
135    #{'value': 'MIN30', 'option': 'Half-hourly', 'title': 'Half-hourly'},
136    #{'value': 'DAY', 'option': 'Daily', 'title': 'Daily'},
137    #{'value': 'WEEK', 'option': 'Weekly', 'title': 'Weekly'},
138    #{'value': 'DAYLIGHT', 'option': 'Daylight', 'title': 'Daylight averages'},
139    #{'value': 'NIGHT', 'option': 'Nighttime', 'title': 'Nighttime averages'}
140]
141
142#
143#
144##
145### section: Local settings and environment variables
146##
147#
148#
149
150# perform all environment variable replacements
151from chart import core_env
152core_env.init_env(globals())
153
154# Run the post-settings core script for final tidying up of settings
155globals().update(runpy.run_module('chart.post_settings', init_globals=globals()))