diff --git a/CalibreWebCompanion/CalibreWebCompanion/__pycache__/settings.cpython-38.pyc b/CalibreWebCompanion/CalibreWebCompanion/__pycache__/settings.cpython-38.pyc index 20b35ca..aaa27cd 100644 Binary files a/CalibreWebCompanion/CalibreWebCompanion/__pycache__/settings.cpython-38.pyc and b/CalibreWebCompanion/CalibreWebCompanion/__pycache__/settings.cpython-38.pyc differ diff --git a/CalibreWebCompanion/CalibreWebCompanion/settings.py b/CalibreWebCompanion/CalibreWebCompanion/settings.py index e25b9fa..7484635 100644 --- a/CalibreWebCompanion/CalibreWebCompanion/settings.py +++ b/CalibreWebCompanion/CalibreWebCompanion/settings.py @@ -19,6 +19,20 @@ CALIBRE_DIR = os.path.abspath( EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + +# optimisation stuff +CONN_MAX_AGE = 60 * 5 + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + 'LOCATION': 'unique-snowflake', + "TIMEOUT" : 60 * 5, + + } +} + + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ @@ -33,7 +47,7 @@ STATIC_URL = '/static/' # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ -# SECURITY WARNING: keep the secret key used in production secret! +# SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'u(8^+rb%rz5hsx4v^^y(ul7g(4n7a8!db@s*9(m5cs*2_ppy8+' @@ -43,7 +57,7 @@ INTERNAL_IPS = [ '127.0.0.1', # ... ] -# Don't change things beyond this + # SECURITY WARNING: don't run with debug turned on in production! @@ -83,6 +97,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'debug_toolbar.middleware.DebugToolbarMiddleware', # DEBUG purposes + 'django.middleware.cache.UpdateCacheMiddleware', # cache 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', @@ -90,6 +105,7 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.cache.FetchFromCacheMiddleware', # cache ] ROOT_URLCONF = 'CalibreWebCompanion.urls' diff --git a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc index 4daacd3..adcae8b 100644 Binary files a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc differ diff --git a/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc index 9f84413..199ec70 100644 Binary files a/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc differ diff --git a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc index 8fe7e25..bde1878 100644 Binary files a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc differ diff --git a/CalibreWebCompanion/library/models.py b/CalibreWebCompanion/library/models.py index d4a0545..744829b 100644 --- a/CalibreWebCompanion/library/models.py +++ b/CalibreWebCompanion/library/models.py @@ -382,26 +382,4 @@ class BookTagLink(models.Model): # # class Meta: # managed = False -# db_table = 'feeds' -# -# -# class LastReadPositions(models.Model): -# book = models.IntegerField() -# format = models.TextField() -# user = models.TextField() -# device = models.TextField() -# cfi = models.TextField() -# epoch = models.FloatField() -# pos_frac = models.FloatField() -# -# class Meta: -# managed = False -# db_table = 'last_read_positions' - - -# class MetadataDirtied(models.Model): -# book = models.IntegerField() - -# class Meta: -# managed = False -# db_table = 'metadata_dirtied' +# db_table = 'feeds' \ No newline at end of file diff --git a/CalibreWebCompanion/library/templates/base.html b/CalibreWebCompanion/library/templates/base.html index e0ff2e6..c4c8eaa 100644 --- a/CalibreWebCompanion/library/templates/base.html +++ b/CalibreWebCompanion/library/templates/base.html @@ -19,7 +19,7 @@ background-color: #515151; border: 1px #303030; border-radius: 0.5rem; - padding: .2rem .25rem ; + padding: .2rem .25rem; margin: 0.1rem 0.1rem .1rem; } @@ -48,6 +48,7 @@ .tags { width: 25%; } + .added { width: 10%; } @@ -55,12 +56,13 @@ .published { width: 10%; } - + + - {% if user.is_authenticated %} {% block content %} {% endblock %} {% else %} diff --git a/CalibreWebCompanion/library/urls.py b/CalibreWebCompanion/library/urls.py index 5271440..e66bf6d 100644 --- a/CalibreWebCompanion/library/urls.py +++ b/CalibreWebCompanion/library/urls.py @@ -1,6 +1,6 @@ from django.urls import path from . import views - +from django.views.decorators.cache import cache_page urlpatterns = [ diff --git a/CalibreWebCompanion/library/views.py b/CalibreWebCompanion/library/views.py index 146e306..dbb821d 100644 --- a/CalibreWebCompanion/library/views.py +++ b/CalibreWebCompanion/library/views.py @@ -10,6 +10,7 @@ from django.contrib.auth import login from django.contrib.auth.decorators import login_required + @login_required def index(request): return render(request, 'accounts/index.html')