Commit 2772d615 by Chif Gergő

Create separate setting files. Add basic logging

parent ee5bcf00
export DJANGO_SECRET = "very very secret key"
export OS_AUTH_URL=http://example/identity/v3
export OS_PROJECT_ID=123456789
export OS_PROJECT_NAME="example"
......@@ -8,4 +9,4 @@ export OS_USERNAME="example"
export OS_PASSWORD=secret
export OS_REGION_NAME="example"
export OS_INTERFACE="example"
export OS_IDENTITY_API_VERSION=123
\ No newline at end of file
export OS_IDENTITY_API_VERSION=123
......@@ -3,7 +3,7 @@ import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "recircle.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "recircle.settings.local")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
......
......@@ -30,8 +30,6 @@ ALLOWED_HOSTS = ["vm.niif.cloud.bme.hu", "localhost"]
# Application definition
INSTALLED_APPS = [
"instance.apps.InstanceConfig",
"image.apps.ImageConfig",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
......@@ -42,9 +40,17 @@ INSTALLED_APPS = [
"djoser",
"rest_framework_swagger",
"corsheaders",
"template"
]
LOCAL_APPS = [
"image",
"instance",
"storage",
"template",
]
INSTALLED_APPS += LOCAL_APPS
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
......@@ -172,3 +178,48 @@ CONNECTION = {
"interface": os.getenv("OS_INTERFACE"),
"identity_api_version": os.getenv("OS_IDENTITY_API_VERSION"),
}
# LOGGING = {
# 'version': 1,
# 'disable_existing_loggers': False,
# 'handlers': {
# 'file': {
# 'level': 'DEBUG',
# 'class': 'logging.FileHandler',
# 'filename': '/recircle/logs/django/debug.log',
# },
# },
# 'loggers': {
# 'django': {
# 'handlers': ['file'],
# 'level': 'DEBUG',
# 'propagate': True,
# },
# },
# }
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '%(asctime)s [%(levelname)s]: %(name)s %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S',
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'simple',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
},
},
}
for i in LOCAL_APPS:
LOGGING['loggers'][i] = {'handlers': ['console'], 'level': 'DEBUG'}
from .base import *
DEBUG = True
# CORS config for development version only
CORS_ORIGIN_WHITELIST = ("http://localhost:3000",)
for i in LOCAL_APPS:
LOGGING['loggers'][i] = {'handlers': ['console'], 'level': 'DEBUG'}
ADMIN_ENABLED = True
ALLOWED_HOSTS = ['*']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment