From 9b0e1eb7ceb5bbde7a19ef56096c603354a6d4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 26 Jan 2017 06:56:46 +0100 Subject: [PATCH] updated sample settings tu current version --- server/src/server/settings.py.sample | 175 +++++++++++++++++---------- 1 file changed, 113 insertions(+), 62 deletions(-) diff --git a/server/src/server/settings.py.sample b/server/src/server/settings.py.sample index 36f1536a..44f2fe55 100644 --- a/server/src/server/settings.py.sample +++ b/server/src/server/settings.py.sample @@ -5,36 +5,44 @@ Settings file for uds server (Django) from __future__ import unicode_literals import os +import sys import django import django.conf.global_settings as DEFAULT_SETTINGS +# Related to shell plus +NOTEBOOK_ARGUMENTS = [ + '--ip=172.27.0.1', + '--port=8888', +] + # calculated paths for django and the site # used as starting points for various other paths DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__)) -BASE_DIR = '/'.join(os.path.dirname(os.path.realpath(__file__)).split('/')[:-1]) +BASE_DIR = '/'.join(os.path.dirname(os.path.abspath(__file__)).split('/')[:-1]) # If used 'relpath' instead of abspath, returns path of "enterprise" instead of "openuds" DEBUG = True -TEMPLATE_DEBUG = DEBUG # USE_X_FORWARDED_HOST = True -SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') # For testing begind a reverse proxy +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') # For testing behind a reverse proxy DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'OPTIONS': { 'init_command': 'SET default_storage_engine=INNODB; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;', - # 'init_command': 'SET storage_engine=INNODB, SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED', # 'init_command': 'SET storage_engine=MYISAM, SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED', }, - 'NAME': 'dbuds', # Or path to database file if using sqlite3. - 'USER': 'dbuds', # Not used with sqlite3. - 'PASSWORD': 'PASSWOR', # Not used with sqlite3. - 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. - # 'CONN_MAX_AGE': 600, # Enable DB Pooling, 10 minutes max connection duration + # 'STORAGE_ENGINE': 'INNODB', + 'NAME': 'DBUDS', # Or path to database file if using sqlit00e3. + # 'NAME': 'dbuds2_test', # For creating tests + 'USER': 'DBUDS', # Not used with sqlite3. + 'PASSWORD': 'PASSWR', # Not used with sqlite3. + 'HOST': 'SERVER', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. + 'CONN_MAX_AGE': 60, # Disable DB Pooling on development enviromnet } } + ALLOWED_HOSTS = '*' # Local time zone for this installation. Choices can be found here: @@ -45,7 +53,9 @@ ALLOWED_HOSTS = '*' # If running in a Windows environment this must be set to the same as your # system time zone. +# TIME_SECTION_START TIME_ZONE = 'Europe/Madrid' +# TIME_SECTION_END # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html @@ -137,10 +147,11 @@ FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o750 FILE_UPLOAD_MAX_MEMORY_SIZE = 512 * 1024 # 512 Kb # Make this unique, and don't share it with anybody. -SECRET_KEY = 's5ky!7b5f#s35!e38xv%e-+iey6yi-#630x)tm1hf6_j8rie2*' +SECRET_KEY = 's5ky!7b5f#s35!e38xv%e-+iey6yi-#630x)kk3kk5_j8rie2*' # This is a very long string, an RSA KEY (this can be changed, but if u loose it, all encription will be lost) RSA_KEY = '-----BEGIN RSA PRIVATE KEY-----\nMIICXgIBAAKBgQC0qe1GlriQbHFYdKYRPBFDSS8Ne/TEKI2mtPKJf36XZTy6rIyH\nvUpT1gMScVjHjOISLNJQqktyv0G+ZGzLDmfkCUBev6JBlFwNeX3Dv/97Q0BsEzJX\noYHiDANUkuB30ukmGvG0sg1v4ccl+xs2Su6pFSc5bGINBcQ5tO0ZI6Q1nQIDAQAB\nAoGBAKA7Octqb+T/mQOX6ZXNjY38wXOXJb44LXHWeGnEnvUNf/Aci0L0epCidfUM\nfG33oKX4BMwwTVxHDrsa/HaXn0FZtbQeBVywZqMqWpkfL/Ho8XJ8Rsq8OfElrwek\nOCPXgxMzQYxoNHw8V97k5qhfupQ+h878BseN367xSyQ8plahAkEAuPgAi6aobwZ5\nFZhx/+6rmQ8sM8FOuzzm6bclrvfuRAUFa9+kMM2K48NAneAtLPphofqI8wDPCYgQ\nTl7O96GXVQJBAPoKtWIMuBHJXKCdUNOISmeEvEzJMPKduvyqnUYv17tM0JTV0uzO\nuDpJoNIwVPq5c3LJaORKeCZnt3dBrdH1FSkCQQC3DK+1hIvhvB0uUvxWlIL7aTmM\nSny47Y9zsc04N6JzbCiuVdeueGs/9eXHl6f9gBgI7eCD48QAocfJVygphqA1AkEA\nrvzZjcIK+9+pJHqUO0XxlFrPkQloaRK77uHUaW9IEjui6dZu4+2T/q7SjubmQgWR\nZy7Pap03UuFZA2wCoqJbaQJAUG0FVrnyUORUnMQvdDjAWps2sXoPvA8sbQY1W8dh\nR2k4TCFl2wD7LutvsdgdkiH0gWdh5tc1c4dRmSX1eQ27nA==\n-----END RSA PRIVATE KEY-----' + TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', @@ -159,7 +170,7 @@ TEMPLATES = [ 'django.contrib.messages.context_processors.messages', 'uds.core.util.Config.context_processor', 'uds.core.util.html.context', - 'django.core.context_processors.request', + 'django.template.context_processors.request', ], 'debug': DEBUG, }, @@ -172,9 +183,11 @@ MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.security.SecurityMiddleware', 'uds.core.util.request.GlobalRequestMiddleware', 'uds.core.util.middleware.XUACompatibleMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'uds.plugins.enterprise.middleware.Middleware', ] SESSION_EXPIRE_AT_BROWSER_CLOSE = True @@ -188,18 +201,12 @@ ROOT_URLCONF = 'server.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'server.wsgi.application' -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - os.path.join(BASE_DIR, 'templates'), -) - INSTALLED_APPS = ( # 'django.contrib.contenttypes', # Not used 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django_extensions', 'compressor', 'uds', ) @@ -207,8 +214,11 @@ INSTALLED_APPS = ( # Compressor settings (for css/js) COMPRESS_ENABLED = not DEBUG COMPRESS_OUTPUT_DIR = 'cache' +COMPRESS_CACHE_BACKEND = 'default' # 'memory' +COMPRESS_STORAGE = 'uds.core.util.FileStorage.CompressorFileStorage' COMPRESS_PRECOMPILERS = ( - ('text/coffeescript', 'coffee --compile --stdio'), + ('text/coffeescript', 'coffee --compile --stdio'), # Original, unchanged +# ('text/coffeescript', 'coffee --compile -p {infile} | babel --blacklist strict -o {outfile}'), # Allows use of generators, etc.. on unsupported browers ('text/less', 'lessc {infile} {outfile}'), ('text/x-sass', 'sass {infile} {outfile}'), ('text/x-scss', 'sass --scss {infile} {outfile}'), @@ -217,11 +227,11 @@ COMPRESS_PRECOMPILERS = ( ) if DEBUG: COMPRESS_DEBUG_TOGGLE = 'debug' -# +# # Enable this if you need to allow round robin load balancing of web server # This is so because we need to share the files between servers # Another options is put /var/server/static on a shared nfs forder for all servers -# +# # COMPRESS_STORAGE = 'uds.core.util.FileStorage.CompressorFileStorage' # See http://docs.djangoproject.com/en/dev/topics/logging for @@ -229,28 +239,27 @@ if DEBUG: LOGDIR = BASE_DIR + '/' + 'log' LOGFILE = 'uds.log' SERVICESFILE = 'services.log' +WORKERSFILE = 'workers.log' AUTHFILE = 'auth.log' USEFILE = 'use.log' +TRACEFILE = 'trace.log' LOGLEVEL = DEBUG and 'DEBUG' or 'INFO' ROTATINGSIZE = 32 * 1024 * 1024 # 32 Megabytes before rotating files -# Tests runner is default tests runner -TEST_RUNNER = 'django.test.runner.DiscoverRunner' - LOGGING = { 'version': 1, 'disable_existing_loggers': True, 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse', - } + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse', + } }, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' }, 'simple': { - 'format': '%(levelname)s %(asctime)s %(module)s %(message)s' + 'format': '%(levelname)s %(asctime)s %(module)s %(funcName)s %(lineno)d %(message)s' }, 'database': { 'format': '%(levelname)s %(asctime)s Database %(message)s' @@ -260,17 +269,20 @@ LOGGING = { }, 'use': { 'format': '%(asctime)s %(message)s' + }, + 'trace': { + 'format': '%(levelname)s %(asctime)s %(message)s' } }, 'handlers': { 'null': { - 'level':'DEBUG', - 'class':'logging.NullHandler', + 'level': 'DEBUG', + 'class': 'logging.NullHandler', }, - - 'file':{ - 'level':'DEBUG', - 'class':'logging.handlers.RotatingFileHandler', + + 'file': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', 'formatter': 'simple', 'filename': LOGDIR + '/' + LOGFILE, 'mode': 'a', @@ -279,20 +291,20 @@ LOGGING = { 'encoding': 'utf-8' }, - 'database':{ - 'level':'ERROR', - 'class':'logging.handlers.RotatingFileHandler', + 'database': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', 'formatter': 'simple', - 'filename': LOGDIR + '/' + 'db.log', + 'filename': LOGDIR + '/' + 'sql.log', 'mode': 'a', 'maxBytes': ROTATINGSIZE, 'backupCount': 3, 'encoding': 'utf-8' }, - - 'servicesFile':{ - 'level':'DEBUG', - 'class':'logging.handlers.RotatingFileHandler', + + 'servicesFile': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', 'formatter': 'simple', 'filename': LOGDIR + '/' + SERVICESFILE, 'mode': 'a', @@ -301,9 +313,20 @@ LOGGING = { 'encoding': 'utf-8' }, - 'authFile':{ - 'level':'DEBUG', - 'class':'logging.handlers.RotatingFileHandler', + 'workersFile': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'formatter': 'simple', + 'filename': LOGDIR + '/' + WORKERSFILE, + 'mode': 'a', + 'maxBytes': ROTATINGSIZE, + 'backupCount': 3, + 'encoding': 'utf-8' + }, + + 'authFile': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', 'formatter': 'auth', 'filename': LOGDIR + '/' + AUTHFILE, 'mode': 'a', @@ -312,9 +335,9 @@ LOGGING = { 'encoding': 'utf-8' }, - 'useFile':{ - 'level':'DEBUG', - 'class':'logging.handlers.RotatingFileHandler', + 'useFile': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', 'formatter': 'use', 'filename': LOGDIR + '/' + USEFILE, 'mode': 'a', @@ -322,10 +345,21 @@ LOGGING = { 'backupCount': 3, 'encoding': 'utf-8' }, - - 'console':{ - 'level':'DEBUG', - 'class':'logging.StreamHandler', + + 'traceFile': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'formatter': 'trace', + 'filename': LOGDIR + '/' + TRACEFILE, + 'mode': 'a', + 'maxBytes': ROTATINGSIZE, + 'backupCount': 3, + 'encoding': 'utf-8' + }, + + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', 'formatter': 'simple' }, 'mail_admins': { @@ -336,9 +370,9 @@ LOGGING = { }, 'loggers': { 'django': { - 'handlers':['null'], + 'handlers': ['null'], 'propagate': True, - 'level':'INFO', + 'level': 'INFO', }, 'django.request': { 'handlers': ['file'], @@ -347,15 +381,26 @@ LOGGING = { }, 'django.db.backends': { 'handlers': ['database'], - 'level': 'ERROR', + 'level': 'DEBUG', 'propagate': False, }, - + 'uds': { 'handlers': ['file'], 'level': LOGLEVEL, }, - + + 'uds.core.workers': { + 'handlers': ['workersFile'], + 'level': LOGLEVEL, + 'propagate': False, + }, + 'uds.core.jobs': { + 'handlers': ['workersFile'], + 'level': LOGLEVEL, + 'propagate': False, + }, + 'uds.services': { 'handlers': ['servicesFile'], 'level': LOGLEVEL, @@ -363,16 +408,22 @@ LOGGING = { }, # Custom Auth log 'authLog': { - 'handlers' : ['authFile'], + 'handlers': ['authFile'], 'level': 'INFO', 'propagate': False, }, # Custom Services use log 'useLog': { - 'handlers' : ['useFile'], + 'handlers': ['useFile'], + 'level': 'INFO', + 'propagate': False, + }, + # Custom tracing + 'traceLog': { + 'handlers': ['traceFile'], 'level': 'INFO', 'propagate': False, } - + } }