Initial commit
This commit is contained in:
0
folkugat_web/config/__init__.py
Normal file
0
folkugat_web/config/__init__.py
Normal file
11
folkugat_web/config/auth.py
Normal file
11
folkugat_web/config/auth.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
SESSION_DURATION = timedelta(minutes=30)
|
||||
COOKIE_NAME = "nota_folkugat"
|
||||
COOKIE_MAX_AGE = int(SESSION_DURATION.total_seconds())
|
||||
ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD", "hola")
|
||||
JWT_SECRET = os.getenv("JWT_SECRET", "".join(random.choice(string.ascii_letters) for _ in range(32)))
|
||||
21
folkugat_web/config/calendari.py
Normal file
21
folkugat_web/config/calendari.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import dataclasses
|
||||
|
||||
CALENDAR_LIST_ID = "calendar-list"
|
||||
HISTORY_LIST_ID = "history-list"
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class PagingConfig:
|
||||
initial_items: int
|
||||
step: int
|
||||
|
||||
|
||||
CALENDARI_PAGING_CONFIG = PagingConfig(
|
||||
initial_items=3,
|
||||
step=2
|
||||
)
|
||||
|
||||
HISTORY_PAGING_CONFIG = PagingConfig(
|
||||
initial_items=3,
|
||||
step=2
|
||||
)
|
||||
23
folkugat_web/config/date.py
Normal file
23
folkugat_web/config/date.py
Normal file
@@ -0,0 +1,23 @@
|
||||
DAY_NAMES_CAT = {
|
||||
0: "Dilluns",
|
||||
1: "Dimarts",
|
||||
2: "Dimecres",
|
||||
3: "Dijous",
|
||||
4: "Divendres",
|
||||
5: "Dissabte",
|
||||
6: "Diumenge",
|
||||
}
|
||||
MONTH_NAMES_CAT = {
|
||||
1: "de Gener",
|
||||
2: "de Febrer",
|
||||
3: "de Març",
|
||||
4: "d'Abril",
|
||||
5: "de Maig",
|
||||
6: "de Juny",
|
||||
7: "de Juliol",
|
||||
8: "de Agost",
|
||||
9: "de Setembre",
|
||||
10: "d'Octubre",
|
||||
11: "de Novembre",
|
||||
12: "de Desembre",
|
||||
}
|
||||
10
folkugat_web/config/db.py
Normal file
10
folkugat_web/config/db.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from folkugat_web.log import logger
|
||||
|
||||
DB_DIR = Path(os.getenv("DB_DIR", "/home/marc/tmp/folkugat")).resolve()
|
||||
DB_FILE = DB_DIR / "folkugat.db"
|
||||
DB_TEMES_DIR = DB_DIR / "temes"
|
||||
|
||||
logger.info(f"Using DB_DIR: {DB_DIR}")
|
||||
10
folkugat_web/config/directories.py
Normal file
10
folkugat_web/config/directories.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from pathlib import Path
|
||||
|
||||
from folkugat_web.log import logger
|
||||
|
||||
APP_DIR = Path(__file__).resolve().parent.parent
|
||||
ASSETS_DIR = APP_DIR / "assets"
|
||||
STATIC_DIR = ASSETS_DIR / "static"
|
||||
TEMPLATES_DIR = ASSETS_DIR / "templates"
|
||||
|
||||
logger.info(f"Using APP_DIR: {APP_DIR}")
|
||||
1
folkugat_web/config/nota.py
Normal file
1
folkugat_web/config/nota.py
Normal file
@@ -0,0 +1 @@
|
||||
LOGGED_IN_FOOTER = "😎"
|
||||
8
folkugat_web/config/search.py
Normal file
8
folkugat_web/config/search.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# Minimum ngram length to compute, search string shorther than this limit are ignored
|
||||
MIN_NGRAM_LENGTH = 3
|
||||
|
||||
# Maximum number of insertions/deletions to check for when comparing strings
|
||||
QUERY_NGRAM_RANGE = 2
|
||||
|
||||
# Maximum distance to show a match as the result of a search
|
||||
SEARCH_DISTANCE_THRESHOLD = 0.25
|
||||
Reference in New Issue
Block a user