1
0
Fork 0
mirror of https://github.com/Findus23/acronomy.git synced 2024-09-19 15:33:45 +02:00

set up caching

This commit is contained in:
Lukas Winkler 2020-06-02 18:36:44 +02:00
parent 917e15ee0b
commit f4f17be679
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 46 additions and 2 deletions

View file

@ -35,7 +35,8 @@ INSTALLED_APPS = [
'simple_history', 'simple_history',
'debug_toolbar', 'debug_toolbar',
'rest_framework', 'rest_framework',
'bootstrap4' 'bootstrap4',
"cachalot"
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -126,6 +127,14 @@ INTERNAL_IPS = [
'127.0.0.1', '127.0.0.1',
] ]
if Production:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
TAGGIT_CASE_INSENSITIVE = True TAGGIT_CASE_INSENSITIVE = True
SECURE_BROWSER_XSS_FILTER = True SECURE_BROWSER_XSS_FILTER = True
@ -139,3 +148,22 @@ if Production:
SECURE_HSTS_INCLUDE_SUBDOMAINS = True SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SESSION_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True
if DEBUG:
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
'debug_toolbar.panels.profiling.ProfilingPanel',
] # default
DEBUG_TOOLBAR_PANELS.append("cachalot.panels.CachalotPanel")

17
poetry.lock generated
View file

@ -163,6 +163,18 @@ django = ">=2.2,<4.0"
python = "<3.8" python = "<3.8"
version = ">=1.5.0,<2.0.0" version = ">=1.5.0,<2.0.0"
[[package]]
category = "main"
description = "Caches your Django ORM queries and automatically invalidates them."
name = "django-cachalot"
optional = false
python-versions = "*"
version = "2.2.0"
[package.dependencies]
Django = ">=1.11"
six = ">=1.13"
[[package]] [[package]]
category = "main" category = "main"
description = "A configurable set of panels that display various debug information about the current request/response." description = "A configurable set of panels that display various debug information about the current request/response."
@ -412,7 +424,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
testing = ["jaraco.itertools", "func-timeout"] testing = ["jaraco.itertools", "func-timeout"]
[metadata] [metadata]
content-hash = "663794bff5f44b62e356d455b9b1e1f7091c386ab61068589b681f5dd98eac01" content-hash = "bdfe2e7b4c2741554f3480b96ef5e05b9940b06c5520832e2dd7e98351c15be6"
python-versions = ">=3.7,<4.0" python-versions = ">=3.7,<4.0"
[metadata.files] [metadata.files]
@ -505,6 +517,9 @@ django-bootstrap4 = [
{file = "django-bootstrap4-2.0.0.tar.gz", hash = "sha256:2618205322306b1cf3e4e67ec9d42cdf30b2656bf06d2b65d17498b0b2667271"}, {file = "django-bootstrap4-2.0.0.tar.gz", hash = "sha256:2618205322306b1cf3e4e67ec9d42cdf30b2656bf06d2b65d17498b0b2667271"},
{file = "django_bootstrap4-2.0.0-py3-none-any.whl", hash = "sha256:ca51246ea4a0bc06f7fa4305cefe7f7700cc09e7da1280f7bea5213470bb673d"}, {file = "django_bootstrap4-2.0.0-py3-none-any.whl", hash = "sha256:ca51246ea4a0bc06f7fa4305cefe7f7700cc09e7da1280f7bea5213470bb673d"},
] ]
django-cachalot = [
{file = "django-cachalot-2.2.0.tar.gz", hash = "sha256:c6fa5d0b8c0f8e812e4d9d512d0f923937413f6a892276fe0b094da57cd0d321"},
]
django-debug-toolbar = [ django-debug-toolbar = [
{file = "django-debug-toolbar-2.2.tar.gz", hash = "sha256:eabbefe89881bbe4ca7c980ff102e3c35c8e8ad6eb725041f538988f2f39a943"}, {file = "django-debug-toolbar-2.2.tar.gz", hash = "sha256:eabbefe89881bbe4ca7c980ff102e3c35c8e8ad6eb725041f538988f2f39a943"},
{file = "django_debug_toolbar-2.2-py3-none-any.whl", hash = "sha256:ff94725e7aae74b133d0599b9bf89bd4eb8f5d2c964106e61d11750228c8774c"}, {file = "django_debug_toolbar-2.2-py3-none-any.whl", hash = "sha256:ff94725e7aae74b133d0599b9bf89bd4eb8f5d2c964106e61d11750228c8774c"},

View file

@ -18,6 +18,7 @@ Pillow = "^7.1.2"
gunicorn = "^20.0.4" gunicorn = "^20.0.4"
beautifulsoup4 = "^4.9.1" beautifulsoup4 = "^4.9.1"
django-bootstrap4 = "^2.0.0" django-bootstrap4 = "^2.0.0"
django-cachalot = "^2.2.0"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
bpython = "^0.19" bpython = "^0.19"