From f44e426991ca09a215eeb0c157b71989cd64e3bf Mon Sep 17 00:00:00 2001 From: Damien Accorsi Date: Thu, 10 Oct 2024 14:16:31 +0200 Subject: [PATCH] minor README fix about rename from jssg to jfmengine --- jssg/settings.py | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/jssg/settings.py b/jssg/settings.py index a19f253..5ded34d 100644 --- a/jssg/settings.py +++ b/jssg/settings.py @@ -23,7 +23,7 @@ https://docs.djangoproject.com/en/5.0/ref/settings/ """ -from django.core.management.commands.runserver import Command as runserver +# from django.core.management.commands.runserver import Command as runserver from os import environ from pathlib import Path @@ -40,24 +40,39 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = environ.get("DJANGO_DEBUG", "false") == "true" - -ALLOWED_HOSTS = ["example.org", "localhost"] +DEBUG = False +if environ.get("DJANGO_DEBUG"): + DEBUG = True +ALLOWED_HOSTS = ["exemple.org", "localhost"] +# runserver.default_port = '8000' +# runserver.default_addr = '127.0.0.1' # JSSG -JFME_DOMAIN = "www.exemple.com" -JFME_CONTENT_DIRS = [BASE_DIR / "example-content"] + [BASE_DIR / "content"] +if environ.get("WEBSITE_DIR") ==None : + raise Exception("Please define WEBSITE_DIR env var. See Readme of algoo/websites repo") +website_dir = Path(environ.get("WEBSITE_DIR")).resolve() +if website_dir.stem == "algoo": + JFME_DOMAIN = "www.algoo.fr" + JFME_CONTENT_DIRS = [website_dir] + [BASE_DIR / "../websites/common-content"] # + [BASE_DIR / "content"] + JFME_INDEX_PAGE = "fr/accueil" + JFME_ADDITIONAL_JINJA2_FILTERS = {"base64encode": "jssg.templatetags.filter_base_64.base64encode"} +elif website_dir.stem == "galae": + JFME_DOMAIN = "www.galae.net" + JFME_CONTENT_DIRS = [website_dir] + [BASE_DIR / "../websites/common-content"] + [BASE_DIR / "content"] + JFME_INDEX_PAGE = "fr/index" + JFME_ADDITIONAL_JINJA2_FILTERS = {} + + JFME_PAGES_DIRS = [path / "pages" for path in JFME_CONTENT_DIRS] JFME_POSTS_DIRS = [path / "posts" for path in JFME_CONTENT_DIRS] JFME_TEMPLATES_DIRS = [path / "templates" for path in JFME_CONTENT_DIRS] JFME_STATIC_DIRS = [path / "static" for path in JFME_CONTENT_DIRS] -JFME_DEFAULT_METADATA_DICT = {"slug": "index", } # The order of include is : JFME_DEFAULT_METADATA_DICT then JFME_DEFAULT_METADATA_FILEPATH then page metadata -JFME_DEFAULT_METADATA_FILEPATH = BASE_DIR / "jssg" / "default_metadata.txt" # If a metadata is specified more than once, the last included is retained -JFME_NUMBER_OF_POSTS_BY_PAGE = 3 # no pagination of posts if set to 0 or -1 +JFME_DEFAULT_METADATA_DICT = {} +JFME_DEFAULT_METADATA_FILEPATH = BASE_DIR / "jssg" / "default_metadata.txt" +JFME_NUMBER_OF_POSTS_BY_PAGE = -1 JFME_CONTENT_REQUIRED_METADATA = ["title", "slug", "lang", "description"] -JFME_SITEMAP_LASTMOD_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z" # strftime format, see https://docs.python.org/fr/3.6/library/datetime.html#strftime-and-strptime-behavior, see https://www.sitemaps.org/protocol.html#lastmoddef for allowed datetime formats -JFME_INDEX_PAGE = "en/home" +JFME_SITEMAP_LASTMOD_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z" JFME_ADDITIONAL_JINJA2_FUNCTIONS = {} -JFME_ADDITIONAL_JINJA2_FILTERS = {} #Django sites and sitemap app SITE_ID = 1 @@ -168,3 +183,7 @@ DJANGO_VITE_PLUGIN = { "MANIFEST": VITE_MANIFEST_FILE, } + +# import re +# from django.template import base +# base.tag_re = re.compile(base.tag_re.pattern, re.DOTALL)