Ejemplo n.º 1
0
# Status codes returned by functions
SUCCESS = 0
OTHER = 1
ERROR = -1

# Overall system and thread states
RUNNING = 0
RECOVERABLE = 1
IRRECOVERABLE = -1

# Thread behaviour
KILL = -1

# Logging specific
LOGGING_PATH = __Path("/home/pi/Hue/logs")
ERROR_LOG_FILE = "HUE_ERROR"
STANDARD_LOG_FILE = "HUE"
LOG_FILE_FORMAT = __logging.Formatter(
    "%(asctime)s, %(levelname)s, %(module)s.%(funcName)s()->%(lineno)d,       %(message)s"
)

# Number of days in a week
DAYS_IN_WEEK = 7
# Check the the season every Monday
DAY_OF_WEEK_TO_CHECK_SEASON = 1

# Seasons determined by their months
WINTER_MONTHS = [12, 1, 2]  # Dec, Jan, Feb
SPRING_MONTHS = [3, 4, 5]  # Mar, Apr, May
SUMMER_MONTHS = [6, 7, 8, 9]  # Jun, Jul, Aug, Sep
Ejemplo n.º 2
0
"""
    Base Django settings
"""

import logging
from pathlib import Path as __Path

from django.utils.translation import gettext_lazy as _

from deploy_django.app_settings import *

###############################################################################

# Build paths relative to the project root:
PROJECT_PATH = __Path(__file__).parent.parent.parent
print(f'PROJECT_PATH:{PROJECT_PATH}')

if __Path('/.dockerenv').is_file():
    # We are inside a docker container
    BASE_PATH = __Path('/django_volumes')
    assert BASE_PATH.is_dir()
else:
    # Build paths relative to the current working directory:
    BASE_PATH = __Path().cwd().resolve()

print(f'BASE_PATH:{BASE_PATH}')

# Paths with Django dev. server:
# BASE_PATH...: .../django-for-runners
# PROJECT_PATH: .../django-for-runners/src
#
Ejemplo n.º 3
0
# but you can use the options and documentation in this file to find out what can be done.

################################################################################
################################################################################

from pathlib import Path as __Path

from django_ynh.secret_key import get_or_create_secret as __get_or_create_secret
from inventory_project.settings.base import *  # noqa


DEBUG = False  # Don't turn DEBUG on in production!

# -----------------------------------------------------------------------------

FINAL_HOME_PATH = __Path('__FINAL_HOME_PATH__')  # /opt/yunohost/$app
assert FINAL_HOME_PATH.is_dir(), f'Directory not exists: {FINAL_HOME_PATH}'

FINAL_WWW_PATH = __Path('__FINAL_WWW_PATH__')  # /var/www/$app
assert FINAL_WWW_PATH.is_dir(), f'Directory not exists: {FINAL_WWW_PATH}'

LOG_FILE = __Path('__LOG_FILE__')  # /var/log/$app/pyinventory.log
assert LOG_FILE.is_file(), f'File not exists: {LOG_FILE}'

PATH_URL = '__PATH_URL__'  # $YNH_APP_ARG_PATH
PATH_URL = PATH_URL.strip('/')

# -----------------------------------------------------------------------------

ROOT_URLCONF = 'urls'  # /opt/yunohost/pyinventory/ynh_urls.py
Ejemplo n.º 4
0
'''
    Base Django settings
'''

import logging
from pathlib import Path as __Path

from ckeditor.configs import DEFAULT_CONFIG
from django.utils.translation import gettext_lazy as _

###############################################################################

# Build paths relative to the project root:
PROJECT_PATH = __Path(__file__).parent.parent.parent
print(f'PROJECT_PATH:{PROJECT_PATH}')

if __Path('/.dockerenv').is_file():
    # We are inside a docker container
    BASE_PATH = __Path('/django_volumes')
    assert BASE_PATH.is_dir()
else:
    # Build paths relative to the current working directory:
    BASE_PATH = __Path().cwd().resolve()

print(f'BASE_PATH:{BASE_PATH}')

# Paths with Django dev. server:
# BASE_PATH...: .../django-for-runners
# PROJECT_PATH: .../django-for-runners/src
#
# Paths in Docker container:
Ejemplo n.º 5
0
    but you can use the options and documentation in this file to find out
    what can be done.
    **************************************************************************

    Django Settings here depends on YunoHost app settings.
"""
from pathlib import Path as __Path

from django_ynh.base_settings import *  # noqa
from django_ynh.secret_key import get_or_create_secret as __get_or_create_secret

DEBUG = True  # This is only the DEMO app ;) But should never be on in production!

# -----------------------------------------------------------------------------

FINAL_HOME_PATH = __Path('__FINAL_HOME_PATH__')  # /opt/yunohost/$app
assert FINAL_HOME_PATH.is_dir(), f'Directory not exists: {FINAL_HOME_PATH}'

FINAL_WWW_PATH = __Path('__FINAL_WWW_PATH__')  # /var/www/$app
assert FINAL_WWW_PATH.is_dir(), f'Directory not exists: {FINAL_WWW_PATH}'

LOG_FILE = __Path('__LOG_FILE__')  # /var/log/$app/django_ynh.log
assert LOG_FILE.is_file(), f'File not exists: {LOG_FILE}'

PATH_URL = '__PATH_URL__'  # $YNH_APP_ARG_PATH
PATH_URL = PATH_URL.strip('/')

# -----------------------------------------------------------------------------

# Function that will be called to finalize a user profile:
YNH_SETUP_USER = '******'
Ejemplo n.º 6
0
import sys as __sys
from pathlib import Path as __Path

from django.utils.translation import ugettext_lazy as _

from debug_toolbar.settings import CONFIG_DEFAULTS as DEBUG_TOOLBAR_CONFIG

# https://github.com/jedie/django-tools
from django_tools.settings_utils import FnMatchIps

# https://github.com/jedie/django-for-runners
from for_runners.app_settings import *  # @UnusedWildImport
from for_runners_project.utils.venv import get_venv_path as __get_venv_path

# Build paths inside the project:
BASE_PATH = __Path(__file__).resolve().parent

# VirtualEnv root dir, e.g.: /home/<username>/DjangoForRunnersEnv
VENV_PATH = __get_venv_path()

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "Only for the tests ;)"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

SITE_ID = 1
Ejemplo n.º 7
0
# -*- coding: utf-8 -*-
import sys as __sys
from pathlib import Path as __Path

if getattr(__sys, "frozen", False):
    __path = __Path(__sys.executable).parent / "app" / "modules"
else:
    __path = __Path(__path__[0])
modules = [
    module for module in __path.glob("*.py")
    if module.is_file() and not module.name.startswith("_")
    and not module.name.endswith("__init__.py")
]
Ejemplo n.º 8
0
from pathlib import Path as __Path

BASE_PATH = __Path(__file__).parent

# The script that will be called to make the deployment:
DEPLOYMENT_SCRIPT = __Path(BASE_PATH, 'example_deployment.py')
Ejemplo n.º 9
0
from .fluxogram import Fluxogram
from .gui import GUI

from pathlib import Path as __Path

home = __Path(__file__).absolute().parent.parent

Ejemplo n.º 10
0
from django.utils.translation import ugettext_lazy as _

from debug_toolbar.settings import CONFIG_DEFAULTS as DEBUG_TOOLBAR_CONFIG

# https://github.com/jedie/django-tools
from django_tools.settings_utils import FnMatchIps

# https://github.com/jedie/django-for-runners
from for_runners.app_settings import *  # @UnusedWildImport
from for_runners_project.utils.venv import get_venv_path as __get_venv_path

env = environ.Env()

# Build paths inside the project:
BASE_PATH = __Path(__file__).resolve().parent

# VirtualEnv root dir, e.g.: /home/<username>/DjangoForRunnersEnv
VENV_PATH = __get_venv_path()

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "Only for the tests ;)"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

SITE_ID = 1