Esempio n. 1
0
STATICFILES_DIRS = [
    os.path.join(PROJECT_DIR, 'static', 'agency'),
]

# ManifestStaticFilesStorage is recommended in production, to prevent outdated
# Javascript / CSS assets being served from cache (e.g. after a Wagtail upgrade).
# See https://docs.djangoproject.com/en/3.0/ref/contrib/staticfiles/#manifeststaticfilesstorage
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

# Logging
LOGGING = DEFAULT_LOGGING.copy()
# Define root logger of the project.
LOGGING['loggers']['portfolio'] = {
    'handlers': ['console', 'mail_admins'],
    'level': 'INFO',
}

# Wagtail settings

WAGTAIL_SITE_NAME = "Portfolio"

# Base URL to use when referring to full URLs within the Wagtail admin backend -
# e.g. in notification emails. Don't include '/admin' or a trailing slash
BASE_URL = 'http://testserver'
Esempio n. 2
0
LOGGING['loggers']['pisa'] = {
    'level': 'DEBUG',
    'handlers': ['console']
}

LOGGING['loggers']['django'] = {
    'level': 'DEBUG',
    'handlers': ['console']
}

LOGGING['loggers']['django.security'] = {
    'level': 'DEBUG',
    'handlers': ['console']
}
LOGGING['formatters'] = LOGGING.get('formatters', {})
LOGGING['formatters']['verbose'] = {
    'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
    'datefmt': "%d/%b/%Y %H:%M:%S"
}

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

PAYMENT_PROCESSORS = {
    'manual': {
        'class': 'silver.payment_processors.manual.ManualProcessor'
    },
}

PAYMENT_METHOD_SECRET = b'YOUR_FERNET_KEY_HERE'  # Fernet.generate_key()
Esempio n. 3
0
    def ready(self):
        super().ready()

        if setting_logging_enable.value:
            logging_configuration = DEFAULT_LOGGING.copy()

            logging_configuration.update({
                'version': 1,
                'disable_existing_loggers': False,
                'formatters': {
                    'mayan_intermediate': {
                        '()':
                        'mayan.apps.logging.formatters.ColorFormatter',
                        'format':
                        '%(name)s <%(process)d> [%(levelname)s] "%(funcName)s() line %(lineno)d %(message)s"',
                    },
                    'mayan_logfile': {
                        'format':
                        '%(asctime)s %(name)s <%(process)d> [%(levelname)s] "%(funcName)s() line %(lineno)d %(message)s"'
                    },
                },
                'handlers': {
                    'console': {
                        'class': 'logging.StreamHandler',
                        'formatter': 'mayan_intermediate',
                        'level': 'DEBUG',
                    },
                }
            })

            # Convert to list to it mutable
            handlers = list(setting_logging_handlers.value)

            if 'logfile' in handlers:
                path = Path(setting_logging_log_file_path.value)
                try:
                    path.touch()
                except (FileNotFoundError, PermissionError):
                    # The path's folder do not exists or we lack
                    # permission to write the log file.
                    handlers.remove('logfile')
                else:
                    logging_configuration['handlers']['logfile'] = {
                        'backupCount': 5,
                        'class': 'logging.handlers.RotatingFileHandler',
                        'filename': setting_logging_log_file_path.value,
                        'formatter': 'mayan_logfile',
                        'maxBytes': 65535,
                    }

            loggers = {}

            # Django loggers
            for key, value in logging_configuration['loggers'].items():
                value['level'] = setting_logging_level.value

            # Mayan apps loggers
            for project_app in apps.apps.get_app_configs():
                loggers[project_app.name] = {
                    'handlers': handlers,
                    'propagate': True,
                    'level': setting_logging_level.value,
                }

            logging_configuration['loggers'] = loggers

            logging.config.dictConfig(config=logging_configuration)
Esempio n. 4
0
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = env_or_default("EMAIL_HOST", "")

DEBUG = False
TEMPLATE_DEBUG = DEBUG

# tells Pinax not to serve media through the staticfiles app.
SERVE_MEDIA = False

# yes, use django-compressor on the server
COMPRESS_ENABLED = True

MEDIA_ROOT = os.environ['MEDIA_ROOT']

from django.utils.log import DEFAULT_LOGGING
LOGGING = DEFAULT_LOGGING.copy()

LOGGING['filters'].update(
    {
        'static_fields': {
            '()': 'pycon.logfilters.StaticFieldFilter',
            'fields': {
                'deployment': 'pycon',
                'environment': '?'   # should be overridden
            },
        },
        'django_exc': {
            '()': 'pycon.logfilters.RequestFilter',
        },
    }
)
Esempio n. 5
0
LOGGING['loggers']['pisa'] = {
    'level': 'DEBUG',
    'handlers': ['console']
}

LOGGING['loggers']['django'] = {
    'level': 'DEBUG',
    'handlers': ['console']
}

LOGGING['loggers']['django.security'] = {
    'level': 'DEBUG',
    'handlers': ['console']
}
LOGGING['formatters'] = LOGGING.get('formatters', {})
LOGGING['formatters']['verbose'] = {
    'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
    'datefmt': "%d/%b/%Y %H:%M:%S"
}

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

PAYMENT_PROCESSORS = {
    'manual': {
        'class': 'silver.payment_processors.manual.ManualProcessor'
    },
}

PAYMENT_METHOD_SECRET = b'YOUR_FERNET_KEY_HERE'  # Fernet.generate_key()