aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--instance/production.py2
-rw-r--r--newspipe/bootstrap.py10
-rw-r--r--newspipe/lib/data.py1
3 files changed, 6 insertions, 7 deletions
diff --git a/instance/production.py b/instance/production.py
index 7fd59916..e5c43190 100644
--- a/instance/production.py
+++ b/instance/production.py
@@ -44,7 +44,7 @@ MAIL_PASSWORD = None
MAIL_DEFAULT_SENDER = "admin@admin.localhost"
# Misc
-BASE_DIR = os.path.abspath(os.path.dirname('.'))
+BASE_DIR = os.path.abspath(os.path.dirname("."))
LANGUAGES = {"en": "English", "fr": "French"}
TIME_ZONE = {"en": "US/Eastern", "fr": "Europe/Paris"}
ADMIN_EMAIL = "admin@admin.localhost"
diff --git a/newspipe/bootstrap.py b/newspipe/bootstrap.py
index 1fdb32e2..2aa39895 100644
--- a/newspipe/bootstrap.py
+++ b/newspipe/bootstrap.py
@@ -53,21 +53,19 @@ if os.environ.get("Newspipe_TESTING", False) == "true":
application.debug = logging.DEBUG
application.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///:memory:"
application.config["TESTING"] = True
+elif os.environ.get("Newspipe_CONFIG", False):
+ # if the configuration file is specified via an environment variable
+ application.config.from_pyfile(os.environ.get("Newspipe_CONFIG"), silent=False)
else:
try:
application.config.from_pyfile("development.py", silent=False)
except Exception:
application.config.from_pyfile("production.py", silent=False)
-# scheme, domain, _, _, _ = urlsplit(conf.PLATFORM_URL)
-# application.config["SERVER_NAME"] = domain
-# application.config["PREFERRED_URL_SCHEME"] = scheme
-
set_logging(application.config["LOG_PATH"])
db = SQLAlchemy(application)
-
babel = Babel(application)
@@ -80,4 +78,4 @@ def get_locale():
# otherwise try to guess the language from the user accept
# header the browser transmits. We support de/fr/en in this
# example. The best match wins.
- return request.accept_languages.best_match(["fr", "en"])
+ return request.accept_languages.best_match(application.config["LANGUAGES"].keys())
diff --git a/newspipe/lib/data.py b/newspipe/lib/data.py
index 5e9457b7..89f6bca6 100644
--- a/newspipe/lib/data.py
+++ b/newspipe/lib/data.py
@@ -44,6 +44,7 @@ from newspipe.controllers import BookmarkController, BookmarkTagController
logger = logging.getLogger(__name__)
+
def import_opml(nickname, opml_content):
"""
Import new feeds from an OPML file.
bgstack15