* Added background color for selected items on admin choices

* Fixes to sample settings file for django 1.10
This commit is contained in:
Adolfo Gómez García 2017-01-11 02:27:29 +01:00
parent 4a16707be3
commit 4e972e0aff
4 changed files with 82 additions and 34 deletions

View File

@ -5,9 +5,16 @@ 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__))
@ -18,6 +25,8 @@ DEBUG = True
# USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') # For testing begind a reverse proxy
# This mark can be used by a setup script to easy locate DB Section of the settings file
# DB_SECTION_START
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
@ -34,6 +43,12 @@ DATABASES = {
# 'CONN_MAX_AGE': 600, # Enable DB Pooling, 10 minutes max connection duration
}
}
# DB_SECTION_END
if b'test' in sys.argv:
DATABASES['default'] = {
'ENGINE': 'django.db.backends.sqlite3'
}
ALLOWED_HOSTS = '*'
# Local time zone for this installation. Choices can be found here:
@ -44,7 +59,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
@ -165,7 +182,7 @@ TEMPLATES = [
},
]
MIDDLEWARE = (
MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
@ -174,7 +191,7 @@ MIDDLEWARE = (
'uds.core.util.request.GlobalRequestMiddleware',
'uds.core.util.middleware.XUACompatibleMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
]
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
@ -192,6 +209,7 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
'compressor',
'uds',
)
@ -199,8 +217,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}'),
@ -221,6 +242,7 @@ if DEBUG:
LOGDIR = BASE_DIR + '/' + 'log'
LOGFILE = 'uds.log'
SERVICESFILE = 'services.log'
WORKERSFILE = 'workers.log'
AUTHFILE = 'auth.log'
USEFILE = 'use.log'
LOGLEVEL = DEBUG and 'DEBUG' or 'INFO'
@ -233,9 +255,9 @@ LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
}
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
}
},
'formatters': {
'verbose': {
@ -256,13 +278,13 @@ LOGGING = {
},
'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',
@ -271,20 +293,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',
@ -293,9 +315,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',
@ -304,9 +337,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',
@ -315,9 +348,9 @@ LOGGING = {
'encoding': 'utf-8'
},
'console':{
'level':'DEBUG',
'class':'logging.StreamHandler',
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
'mail_admins': {
@ -328,9 +361,9 @@ LOGGING = {
},
'loggers': {
'django': {
'handlers':['null'],
'handlers': ['null'],
'propagate': True,
'level':'INFO',
'level': 'INFO',
},
'django.request': {
'handlers': ['file'],
@ -339,7 +372,7 @@ LOGGING = {
},
'django.db.backends': {
'handlers': ['database'],
'level': 'ERROR',
'level': 'DEBUG',
'propagate': False,
},
@ -348,6 +381,17 @@ LOGGING = {
'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,
@ -355,13 +399,13 @@ 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,
}

View File

@ -39,7 +39,7 @@ from uds.models import User
import threading
import logging
__updated__ = '2016-08-26'
__updated__ = '2017-01-11'
logger = logging.getLogger(__name__)
@ -126,6 +126,7 @@ class GlobalRequestMiddleware(object):
'''
Ensures request user is the correct user
'''
logger.debug('Getting User on Middleware')
user = request.session.get(USER_KEY)
if user is not None:
try:

File diff suppressed because one or more lines are too long

View File

@ -409,6 +409,9 @@ span.tag {
}
}
li.selected {
background-color: #5094CE;
}
/* theme */