diff --git a/requirements.txt b/requirements.txt index f0c4a37de3da36fa7e069f7ec3f694fc0fb9d7f9..1220b3cfe76cc8aaa96f2d9d08c1119ab0e19e5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ django_pdb django-material django-filter django_react_templatetags -kanboard PyPDF2 martor -django_widget_tweaks \ No newline at end of file +django_widget_tweaks +python-memcached \ No newline at end of file diff --git a/schoolapps/schoolapps/settings.py b/schoolapps/schoolapps/settings.py index 3a8ae45210903a758ed24b1d6bb81ec660c8b105..40ab386f3282b66cad326f8790de0fdf485a90ba 100755 --- a/schoolapps/schoolapps/settings.py +++ b/schoolapps/schoolapps/settings.py @@ -154,20 +154,29 @@ AUTH_LDAP_MIRROR_GROUPS = True AUTH_LDAP_CACHE_GROUPS = True AUTH_LDAP_GROUP_CACHE_TIMEOUT = 300 -# Keep ModelBackend around for per-user permissions and maybe a local -# superuser. +# Keep ModelBackend around for per-user permissions and maybe a local superuser. AUTHENTICATION_BACKENDS = ( 'django_auth_ldap.backend.LDAPBackend', 'django.contrib.auth.backends.ModelBackend', ) -logger = logging.getLogger('django_auth_ldap') -logger.addHandler(logging.StreamHandler()) if DEBUG: + logger = logging.getLogger('django_auth_ldap') + logger.addHandler(logging.StreamHandler()) logger.setLevel(logging.DEBUG) # Media MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') -#DBSETTINGS_USE_CACHE = False +# Use cache for db settings (only on production) +DBSETTINGS_USE_CACHE = not DEBUG + +# Cache configs (only on production) +if not DEBUG: + CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '127.0.0.1:11211', + } + } diff --git a/schoolapps/timetable/migrations/0011_merge_20191113_1655.py b/schoolapps/timetable/migrations/0011_merge_20191113_1655.py new file mode 100644 index 0000000000000000000000000000000000000000..91d52bea14baca8a9ac6fa7a49754cc7836cc50e --- /dev/null +++ b/schoolapps/timetable/migrations/0011_merge_20191113_1655.py @@ -0,0 +1,13 @@ +# Generated by Django 2.2.6 on 2019-11-13 15:55 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ('timetable', '0010_auto_20190818_0910'), + ('timetable', '0010_auto_20190825_1238'), + ] + + operations = [ + ] diff --git a/schoolapps/untisconnect/plan.py b/schoolapps/untisconnect/plan.py index 89277ab83393e0df084d1b1b83c0072ac6b9d43e..6b9d209b75e9aff18523b24b634507f2c2b6331b 100644 --- a/schoolapps/untisconnect/plan.py +++ b/schoolapps/untisconnect/plan.py @@ -176,7 +176,6 @@ def get_plan(type, id, smart=False, monday_of_week=None, force_update=False): element_container.is_hol = True element_container.element.holiday_reason = hols_for_weekday[time.day - 1][0].name - if type != TYPE_ROOM or i == room_index: # Add this container object to the LessonContainer object in the plan array plan[time.hour - 1][0][time.day - 1].append(element_container) @@ -241,5 +240,5 @@ def get_plan(type, id, smart=False, monday_of_week=None, force_update=False): for j in range(event.event.from_lesson - 1, event.event.to_lesson): plan[j][0][i].append(element_container) - cache.update(plan) + cache.update((plan, hols_for_weekday)) return plan, hols_for_weekday