Cache index
This commit is contained in:
parent
549a483e74
commit
7736025e99
|
@ -7,8 +7,10 @@ from .forms import RepoForm, ArchiveForm, ErrorForm, LocationForm
|
||||||
from django.contrib.auth.decorators import permission_required
|
from django.contrib.auth.decorators import permission_required
|
||||||
from .utility import data
|
from .utility import data
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from django.views.decorators.cache import cache_page
|
||||||
|
|
||||||
|
|
||||||
|
@cache_page(60)
|
||||||
def index(request):
|
def index(request):
|
||||||
repo_list = Repo.objects.all()
|
repo_list = Repo.objects.all()
|
||||||
location_list = Location.objects.all()
|
location_list = Location.objects.all()
|
||||||
|
|
|
@ -20,7 +20,7 @@ SECRET_KEY = __SECRET_KEY
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = ['127.0.0.1']
|
||||||
|
|
||||||
AXES_LOCKOUT_CALLABLE = "borg.views.axes"
|
AXES_LOCKOUT_CALLABLE = "borg.views.axes"
|
||||||
|
|
||||||
|
@ -119,6 +119,11 @@ STATICFILES_FINDERS = [
|
||||||
]
|
]
|
||||||
COMPRESS_PRECOMPILERS = (('text/x-scss', 'django_libsass.SassCompiler'),)
|
COMPRESS_PRECOMPILERS = (('text/x-scss', 'django_libsass.SassCompiler'),)
|
||||||
|
|
||||||
|
COMPRESS_ENABLED = True
|
||||||
|
COMPRESS_OFFLINE = True
|
||||||
|
LIBSASS_OUTPUT_STYLE = 'compressed'
|
||||||
|
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
STATIC_ROOT = os.path.join(BASE_DIR, 'root')
|
STATIC_ROOT = os.path.join(BASE_DIR, 'root')
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
|
@ -126,3 +131,11 @@ STATICFILES_DIRS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
# Cache
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||||
|
'LOCATION': 'unique-snowflake',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ print_action "Installing pip packages, this may take a while..."
|
||||||
|
|
||||||
# install required pip packages
|
# install required pip packages
|
||||||
yes | python -m pip install --upgrade wheel
|
yes | python -m pip install --upgrade wheel
|
||||||
yes | python -m pip install django gunicorn sass django-libsass django-compressor django-axes
|
yes | python -m pip install django gunicorn django-libsass django-compressor django-axes pymemcache
|
||||||
|
|
||||||
print_action "Setting up static files and database"
|
print_action "Setting up static files and database"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user