2019-07-04 23:26:52 +00:00
|
|
|
"""
|
|
|
|
Production settings for linkding webapp
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Start from development settings
|
|
|
|
# noinspection PyUnresolvedReferences
|
|
|
|
import os
|
|
|
|
|
2024-01-28 22:58:03 +00:00
|
|
|
from django.core.management.utils import get_random_secret_key
|
2019-07-04 23:26:52 +00:00
|
|
|
from .base import *
|
|
|
|
|
|
|
|
# Turn of debug mode
|
|
|
|
DEBUG = False
|
|
|
|
|
|
|
|
# Try read secret key from file
|
|
|
|
try:
|
2024-01-28 22:58:03 +00:00
|
|
|
with open(os.path.join(BASE_DIR, "data", "secretkey.txt")) as f:
|
2019-07-04 23:26:52 +00:00
|
|
|
SECRET_KEY = f.read().strip()
|
|
|
|
except:
|
2024-01-28 22:58:03 +00:00
|
|
|
SECRET_KEY = get_random_secret_key()
|
2019-07-04 23:26:52 +00:00
|
|
|
|
|
|
|
# Set ALLOWED_HOSTS
|
|
|
|
# By default look in the HOST_NAME environment variable, if that is not set then allow all hosts
|
2024-01-27 10:29:16 +00:00
|
|
|
host_name = os.environ.get("HOST_NAME")
|
2019-07-04 23:26:52 +00:00
|
|
|
if host_name:
|
|
|
|
ALLOWED_HOSTS = [host_name]
|
|
|
|
else:
|
2024-01-27 10:29:16 +00:00
|
|
|
ALLOWED_HOSTS = ["*"]
|
2019-07-04 23:26:52 +00:00
|
|
|
|
2022-09-11 05:50:08 +00:00
|
|
|
# Logging
|
|
|
|
LOGGING = {
|
2024-01-27 10:29:16 +00:00
|
|
|
"version": 1,
|
|
|
|
"disable_existing_loggers": False,
|
|
|
|
"formatters": {
|
|
|
|
"simple": {
|
|
|
|
"format": "{asctime} {levelname} {message}",
|
|
|
|
"style": "{",
|
2022-09-11 05:50:08 +00:00
|
|
|
},
|
|
|
|
},
|
2024-01-27 10:29:16 +00:00
|
|
|
"handlers": {"console": {"class": "logging.StreamHandler", "formatter": "simple"}},
|
|
|
|
"root": {
|
|
|
|
"handlers": ["console"],
|
|
|
|
"level": "WARN",
|
2022-09-11 05:50:08 +00:00
|
|
|
},
|
2024-01-27 10:29:16 +00:00
|
|
|
"loggers": {
|
|
|
|
"bookmarks": {
|
|
|
|
"level": "INFO",
|
|
|
|
"handlers": ["console"],
|
|
|
|
"propagate": False,
|
2024-04-07 09:11:14 +00:00
|
|
|
},
|
|
|
|
"huey": {
|
|
|
|
"level": "INFO",
|
|
|
|
"handlers": ["console"],
|
|
|
|
"propagate": False,
|
|
|
|
},
|
2024-01-27 10:29:16 +00:00
|
|
|
},
|
2022-09-11 05:50:08 +00:00
|
|
|
}
|
|
|
|
|
2019-07-04 23:26:52 +00:00
|
|
|
# Import custom settings
|
|
|
|
# noinspection PyUnresolvedReferences
|
|
|
|
from .custom import *
|