optimize #1
Binary file not shown.
@ -19,6 +19,20 @@ CALIBRE_DIR = os.path.abspath(
|
|||||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
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)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
||||||
|
|
||||||
@ -33,7 +47,7 @@ STATIC_URL = '/static/'
|
|||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
|
# 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+'
|
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',
|
'127.0.0.1',
|
||||||
# ...
|
# ...
|
||||||
]
|
]
|
||||||
# Don't change things beyond this
|
|
||||||
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
@ -83,6 +97,7 @@ INSTALLED_APPS = [
|
|||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'debug_toolbar.middleware.DebugToolbarMiddleware', # DEBUG purposes
|
'debug_toolbar.middleware.DebugToolbarMiddleware', # DEBUG purposes
|
||||||
|
'django.middleware.cache.UpdateCacheMiddleware', # cache
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
@ -90,6 +105,7 @@ MIDDLEWARE = [
|
|||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
'django.middleware.cache.FetchFromCacheMiddleware', # cache
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'CalibreWebCompanion.urls'
|
ROOT_URLCONF = 'CalibreWebCompanion.urls'
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -382,26 +382,4 @@ class BookTagLink(models.Model):
|
|||||||
#
|
#
|
||||||
# class Meta:
|
# class Meta:
|
||||||
# managed = False
|
# managed = False
|
||||||
# db_table = 'feeds'
|
# 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'
|
|
@ -19,7 +19,7 @@
|
|||||||
background-color: #515151;
|
background-color: #515151;
|
||||||
border: 1px #303030;
|
border: 1px #303030;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
padding: .2rem .25rem ;
|
padding: .2rem .25rem;
|
||||||
margin: 0.1rem 0.1rem .1rem;
|
margin: 0.1rem 0.1rem .1rem;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -48,6 +48,7 @@
|
|||||||
.tags {
|
.tags {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.added {
|
.added {
|
||||||
width: 10%;
|
width: 10%;
|
||||||
}
|
}
|
||||||
@ -55,12 +56,13 @@
|
|||||||
.published {
|
.published {
|
||||||
width: 10%;
|
width: 10%;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="navbar-fixed">
|
<div class="navbar-fixed">
|
||||||
<nav>
|
<nav>
|
||||||
<div class="nav-wrapper row green darken-1">
|
<div class="nav-wrapper row green darken-1">
|
||||||
@ -70,7 +72,9 @@
|
|||||||
<li class="active"><a href="{{user.get_absolute_url}}"> {{ user.get_username }}</a></li>
|
<li class="active"><a href="{{user.get_absolute_url}}"> {{ user.get_username }}</a></li>
|
||||||
<li><a href="{% url 'logout'%}?next={{request.path}}">Logout</a></li>
|
<li><a href="{% url 'logout'%}?next={{request.path}}">Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
{% load cache %}
|
||||||
|
{% cache 500 sidebar request.user.username %}
|
||||||
|
<!--Maybe i'm retarded but this is not caching versions per user-->
|
||||||
<ul class="left">
|
<ul class="left">
|
||||||
<li><a href="{% url 'books' %}">Books</a></li>
|
<li><a href="{% url 'books' %}">Books</a></li>
|
||||||
<li><a class="dropdown-trigger" href={% url 'authors' %} data-target="dropdown-authors">Authors<i
|
<li><a class="dropdown-trigger" href={% url 'authors' %} data-target="dropdown-authors">Authors<i
|
||||||
@ -126,7 +130,7 @@
|
|||||||
<li><a href="{{pub.get_absolute_url}}">{{pub}} <p class="count">{{pub.num_books}}</p> </a> </li>
|
<li><a href="{{pub.get_absolute_url}}">{{pub}} <p class="count">{{pub.num_books}}</p> </a> </li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% endcache %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{% url 'sign-up'%}?next={{request.path}}">Sign up</a></li>
|
<li><a href="{% url 'sign-up'%}?next={{request.path}}">Sign up</a></li>
|
||||||
<li><a href="{% url 'login'%}?next={{request.path}}">Login</a></li>
|
<li><a href="{% url 'login'%}?next={{request.path}}">Login</a></li>
|
||||||
@ -134,7 +138,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
@ -145,7 +148,6 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
{% block content %} {% endblock %}
|
{% block content %} {% endblock %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from . import views
|
from . import views
|
||||||
|
from django.views.decorators.cache import cache_page
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
@ -10,6 +10,7 @@ from django.contrib.auth import login
|
|||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def index(request):
|
def index(request):
|
||||||
return render(request, 'accounts/index.html')
|
return render(request, 'accounts/index.html')
|
||||||
|
Loading…
Reference in New Issue
Block a user