aboutsummaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
authormjfernez <mjf@mjfer.net>2021-10-18 19:53:03 -0400
committermjfernez <mjf@mjfer.net>2021-10-18 19:53:03 -0400
commit7c16beb6538ccf024b552d475a26b9345bf550ec (patch)
tree3d0d7bde43f8f7db5a3a75e54aa0a904b6c83eaf /server.py
parent04431658597c9b9ae489be3363c6b9478d946fcd (diff)
downloadezcms-7c16beb6538ccf024b552d475a26b9345bf550ec.tar.gz
Fixes is_hidden_path, RSS. Adds txt support, RSS
This commit fixes the is_hidden_path function to work for subdirectories and also remove entries from the RSS file view_functions.py has been refactored use the siteconfig file instead of the app to remove unecessary imports and avoid circularly imports This also moves logic for the default site directories from server.py to siteconfig.py so it's accessible before the app runs. This has the benefit of cleaning up the server file, but the drawback of adding the os import to the siteconfig file. Settings have been moved around for (hopefully) easier reading
Diffstat (limited to 'server.py')
-rw-r--r--server.py21
1 files changed, 3 insertions, 18 deletions
diff --git a/server.py b/server.py
index 14c4182..ab66ccc 100644
--- a/server.py
+++ b/server.py
@@ -1,7 +1,6 @@
"""
server.py - sets up and runs the flask server
"""
-import os
from flask import Flask
from siteconfig import siteconfig
from flask_compress import Compress
@@ -20,23 +19,8 @@ def setup():
setup - sets up the app according to the settings specified (or not
specified) in `siteconfig`
"""
- if siteconfig.SECRET_KEY:
- app.config['SECRET_KEY'] = siteconfig.SECRET_KEY
- else:
- SECRET_KEY = os.urandom(32)
- app.config['SECRET_KEY'] = SECRET_KEY
-
- if siteconfig.MAIN_SITE_DIRS:
- app.config.update({'MAIN_SITE_DIRS': siteconfig.MAIN_SITE_DIRS})
- else:
- s = "./templates/site/"
- top_dirs = [
- x
- for x in os.listdir(s)
- if os.path.isdir(s + x) and not x.startswith(".")
- ]
- app.config.update({'MAIN_SITE_DIRS': sorted(top_dirs)})
-
+ app.config['SECRET_KEY'] = siteconfig.SECRET_KEY
+ app.config.update({'MAIN_SITE_DIRS': siteconfig.MAIN_SITE_DIRS})
app.config.update({'DOMAIN': siteconfig.DOMAIN})
app.config.update({'HOME_TITLE': siteconfig.HOME_TITLE})
app.config.update(
@@ -45,6 +29,7 @@ def setup():
app.config.update({'RSS_CHANNEL': get_rss_channel()})
app.config.update({'TEMPLATES_AUTO_RELOAD': True})
+
# Setup needs to come first to be compatible with wsgi
setup()
compress.init_app(app)