From dc5b6221234cf41b627bd69674970eec9584fc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=BCnch?= Date: Sun, 9 Jan 2022 23:05:33 +0100 Subject: [PATCH] cleanup config and old packages, add description how to run tests and clear the cache --- Pipfile | 4 --- README.md | 12 +++++++ .../coinmanager/production_settings.py | 34 +++---------------- coinmanager/coinmanager/settings.py | 17 ---------- 4 files changed, 16 insertions(+), 51 deletions(-) diff --git a/Pipfile b/Pipfile index b360aeb..527e923 100644 --- a/Pipfile +++ b/Pipfile @@ -5,13 +5,9 @@ verify_ssl = true [dev-packages] pudb = "*" -django-extensions = "*" -werkzeug = "*" -pydotplus = "*" [packages] django = "*" -django-cacheops = "*" [requires] python_version = "3.8" diff --git a/README.md b/README.md index 4be532a..625be62 100644 --- a/README.md +++ b/README.md @@ -79,3 +79,15 @@ Alias /static /path/to/coinmanager/static ``` - Test if your config syntax ist OK `apachectl configtest` - Finally restart apache2 `systemctl restart apache2` + +# clear django cache +When things arent changing this may help you: +``` +python manage.py shell +>>> from django.core.cache import cache; cache.clear(); exit() +``` + +# run tests +``` +python manage.py test +``` diff --git a/coinmanager/coinmanager/production_settings.py b/coinmanager/coinmanager/production_settings.py index 4c77780..b043214 100644 --- a/coinmanager/coinmanager/production_settings.py +++ b/coinmanager/coinmanager/production_settings.py @@ -32,7 +32,6 @@ ALLOWED_HOSTS = ['willipink.eu'] INSTALLED_APPS = [ 'coinc.apps.CoincConfig', -# 'cacheops', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -123,10 +122,6 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static/') -SECURE_SSL_REDIRECT = True -SESSION_COOKIE_SECURE = True -CSRF_COOKIE_SECURE = True # Maintenance Mode MAINTENANCE_MODE_READ_ONLY = False @@ -134,28 +129,7 @@ MAINTENANCE_MODE_READ_ONLY = False # do not redirect after login LOGIN_REDIRECT_URL = './' -# caching -# CACHES = { -# 'default': { - # file-based -# 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', -# 'LOCATION': '/var/tmp/django-cache', -# 'TIMEOUT': None, - # memory-based - #'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', - #'LOCATION': 'coinc', - #'TIMEOUT': None, -# } -# } - -# caching -# CACHE_MIDDLEWARE_ALIAS = 'default' -# CACHE_MIDDLEWARE_SECONDS = 60*60*24*365 - -# CACHEOPS_REDIS = "unix://var/run/redis/redis-server.sock" -# CACHEOPS_DEFAULTS = { 'timeout': 60*60*24*365 } -# CACHEOPS = { -# # 'coinc.*': None, -# 'coinc.coin': { 'cache_on_save': True } -# } -# CACHEOPS_DEGRADE_ON_FAILURE = True +STATIC_ROOT = os.path.join(BASE_DIR, 'static/') +SECURE_SSL_REDIRECT = True +SESSION_COOKIE_SECURE = True +CSRF_COOKIE_SECURE = True diff --git a/coinmanager/coinmanager/settings.py b/coinmanager/coinmanager/settings.py index c99c6b9..8b7021d 100644 --- a/coinmanager/coinmanager/settings.py +++ b/coinmanager/coinmanager/settings.py @@ -38,7 +38,6 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'django_extensions', ] MIDDLEWARE = [ @@ -129,19 +128,3 @@ MAINTENANCE_MODE_READ_ONLY = False # do not redirect after login LOGIN_REDIRECT_URL = './' - -# caching modes, i.e. file based, memcached, or other fancy stuff -# https://docs.djangoproject.com/en/3.1/topics/cache/#cache-arguments -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', - 'LOCATION': '/var/tmp/django_cache', - 'TIMEOUT': None, - } -} - -# per-site cache -# updatecachemiddleware: adds 'Expires' and 'Cache-Control' headers to give the -# page a maximum age CACHE_MIDDLEWARE_SECONDS -# CACHE_MIDDLEWARE_ALIAS = 'default' -# CACHE_MIDDLEWARE_SECONDS = 600