Skip to content

Commit 57fe2c9

Browse files
committed
Cache the homepage and sequence pages
1 parent e223e8d commit 57fe2c9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

rnacentral/portal/urls.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,33 @@
1616
from django.conf import settings
1717
from django.http import FileResponse, Http404
1818
from django.urls import re_path
19+
from django.views.decorators.cache import cache_page
1920
from django.views.generic import RedirectView, TemplateView
2021
from portal import views
2122
from portal.models import EnsemblAssembly
2223

24+
CACHE_TIMEOUT = 60 * 60 * 24 * 7
25+
26+
2327
urlpatterns = [
2428
# homepage
25-
re_path(r"^$", views.homepage, name="homepage"),
29+
re_path(r"^$", cache_page(CACHE_TIMEOUT)(views.homepage), name="homepage"),
2630
# unique RNA sequence
2731
re_path(
2832
r"^rna/(?P<upi>URS[0-9A-F]{10})/?$",
29-
views.generic_rna_view,
33+
cache_page(CACHE_TIMEOUT)(views.generic_rna_view),
3034
name="generic-rna-sequence",
3135
),
3236
# species specific identifier with forward slash
3337
re_path(
3438
r"^rna/(?P<upi>URS[0-9A-F]{10})/(?P<taxid>\d+)/?$",
35-
views.rna_view,
39+
cache_page(CACHE_TIMEOUT)(views.rna_view),
3640
name="unique-rna-sequence",
3741
),
3842
# species specific identifier with underscore
3943
re_path(
4044
r"^rna/(?P<upi>URS[0-9A-F]{10})_(?P<taxid>\d+)/?$",
41-
views.rna_view_redirect,
45+
cache_page(CACHE_TIMEOUT)(views.rna_view_redirect),
4246
name="unique-rna-sequence-redirect",
4347
),
4448
# expert database

0 commit comments

Comments
 (0)