Remove site_config file & add templates_local
This commit is contained in:
parent
8c11e02d9c
commit
e37c412fd9
9 changed files with 24 additions and 76 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,7 @@
|
|||
# ---> Muistox
|
||||
media/
|
||||
templates_local/
|
||||
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
|
|
|
@ -43,6 +43,10 @@ TEMPLATES = [
|
|||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [BASE_DIR / "templates"],
|
||||
'DIRS': [
|
||||
BASE_DIR / "templates_local",
|
||||
BASE_DIR / "templates",
|
||||
],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
|
@ -50,7 +54,6 @@ TEMPLATES = [
|
|||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'gallery.context_processors.site_config',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -98,9 +101,8 @@ TIME_ZONE = 'UTC'
|
|||
|
||||
USE_I18N = True
|
||||
|
||||
#USE_TZ = True
|
||||
USE_TZ = False
|
||||
|
||||
# USE_L10N = True
|
||||
# USE_TZ = False
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
|
@ -130,8 +132,8 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|||
# Sessions
|
||||
SESSION_COOKIE_AGE = 60 * 60 * 24 * 365 * 5 # 5 vuotta
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
||||
SESSION_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_SAMESITE = 'Lax'
|
||||
SESSION_CACHE_ALIAS = "default"
|
||||
|
||||
# Sessio backend: cache + fallback tietokantaan
|
||||
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
|
||||
|
@ -143,7 +145,8 @@ CACHES = {
|
|||
"LOCATION": "redis://127.0.0.1:6379/1",
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
}
|
||||
},
|
||||
'KEY_PREFIX': 'session',
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"site_head_title": "Gallery",
|
||||
"site_head_description": "Muistox Photo Gallery",
|
||||
|
||||
"title": "Gallery",
|
||||
"description": "Just another wannabe photographer...",
|
||||
|
||||
"footer_copyright": "Powered by <a href='https://git.hakkeri.net/nyymix/muistox'>muistox</a>.",
|
||||
|
||||
"about_title": "Muistox gallery",
|
||||
"about_description": "Just another wannabe photographer...",
|
||||
"about_profile_image": "img/default.png",
|
||||
|
||||
"contact_email": "muistox@gallery.invalid",
|
||||
"bluesky_url": "https://bsky.app/",
|
||||
"twitter_url": "https://twitter.com/",
|
||||
"instagram_url": "https://www.instagram.com/"
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
|
||||
|
||||
def site_config(request):
|
||||
config = cache.get('site_config')
|
||||
|
||||
if not config:
|
||||
config_path = Path(settings.BASE_DIR) / 'config' / 'site_config.json'
|
||||
try:
|
||||
with open(config_path, 'r') as f:
|
||||
config = json.load(f)
|
||||
cache.set('site_config', config, 3600)
|
||||
except FileNotFoundError:
|
||||
config = {}
|
||||
|
||||
return {'site_config': config}
|
|
@ -27,35 +27,16 @@
|
|||
<div class="uk-width-1-1">
|
||||
<div class="uk-card uk-card-default uk-card-body uk-text-center">
|
||||
|
||||
<h3 class="uk-card-title">{{ site_config.about_title }}</h3>
|
||||
<h3 class="uk-card-title">Muistox gallery</h3>
|
||||
|
||||
<img class="uk-border-circle uk-box-shadow-small uk-margin-small"
|
||||
src="{% static site_config.about_profile_image %}"
|
||||
src="{% static "img/default.png" %}"
|
||||
alt="Profile photo" width="120">
|
||||
|
||||
<p class="uk-text-muted uk-margin-small">
|
||||
{{ site_config.about_description }}
|
||||
Just another wannabe photographer...
|
||||
</p>
|
||||
|
||||
<p class="uk-text-muted uk-margin-small">
|
||||
Contact:
|
||||
<a href="mailto:{{ site_config.contact_email }}">
|
||||
{{ site_config.contact_email }}
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div class="uk-flex uk-flex-center uk-child-width-auto uk-margin-small-top" uk-grid>
|
||||
{% if site_config.bluesky_url %}
|
||||
<a href="{{ site_config.bluesky_url }}" uk-icon="icon: bluesky" uk-tooltip="Bluesky"></a>
|
||||
{% endif %}
|
||||
{% if site_config.twitter_url %}
|
||||
<a href="{{ site_config.twitter_url }}" uk-icon="icon: twitter" uk-tooltip="Twitter"></a>
|
||||
{% endif %}
|
||||
{% if site_config.instagram_url %}
|
||||
<a href="{{ site_config.instagram_url }}" uk-icon="icon: instagram" uk-tooltip="Instagram"></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<hr class="uk-divider-icon">
|
||||
|
||||
<div class="uk-text-small uk-text-muted">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{% load image_tags %}
|
||||
|
||||
<!-- Title -->
|
||||
{% block title %}{{ site_config.description }}{% endblock %}
|
||||
{% block title %}Home{% endblock %}
|
||||
|
||||
<!-- Parallax -->
|
||||
{% block parallax %}
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
<a class="uk-position-center-left uk-position-small uk-hidden-hover" href="#" uk-slidenav-previous uk-slideshow-item="previous"></a>
|
||||
<a class="uk-position-center-right uk-position-small uk-hidden-hover" href="#" uk-slidenav-next uk-slideshow-item="next"></a>
|
||||
<div class="uk-position-top uk-padding-small">
|
||||
<h1>{{ site_config.title }}</h1>
|
||||
<h1>Gallery</h1>
|
||||
</div>
|
||||
<div class="uk-overlay uk-overlay-primary uk-position-bottom uk-padding-small">
|
||||
<p class="uk-text-small uk-margin-remove-top">{{ site_config.description }}</p>
|
||||
<p class="uk-text-small uk-margin-remove-top">Just another wannabe photographer...</p>
|
||||
</div>
|
||||
</div>
|
|
@ -4,8 +4,8 @@
|
|||
{% load static %}
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="{{ site_config.site_head_description }}">
|
||||
<title>{{ site_config.site_head_title }} : Slideshow : {{ photo.album.name }}</title>
|
||||
<meta name="description" content="Muistox Photo Gallery">
|
||||
<title>Slideshow : {{ photo.album.name }} - Gallery</title>
|
||||
{% if next_photo %}
|
||||
<meta http-equiv="refresh" content="5; url={% url 'gallery:photo_slideshow_url' next_photo.album.slug next_photo.slug %}" />
|
||||
{% endif %}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
{% load static %}
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="{{ site_config.site_head_description }}">
|
||||
<title>{% block title %}{% endblock %} - {{ site_config.site_head_title }}</title>
|
||||
<meta name="description" content="Muistox Photo Gallery">
|
||||
<title>{% block title %}{% endblock %} - Gallery</title>
|
||||
{% if canonical_url %}
|
||||
<link rel="canonical" href="{{ canonical_url }}">
|
||||
{% endif %}
|
||||
|
@ -86,7 +86,7 @@
|
|||
<!-- Footer -->
|
||||
<footer class="uk-align-center uk-container-large">
|
||||
<div class="uk-background-secondary uk-padding-small uk-light uk-text-center uk-text-light">
|
||||
© {% now "Y" %} {{ site_config.footer_copyright|safe }}
|
||||
© {% now "Y" %} Powered by <a href="https://git.hakkeri.net/nyymix/muistox">muistox</a>.
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue