diff options
author | mjfernez <mjf@mjfer.net> | 2021-10-18 19:53:03 -0400 |
---|---|---|
committer | mjfernez <mjf@mjfer.net> | 2021-10-18 19:53:03 -0400 |
commit | 7c16beb6538ccf024b552d475a26b9345bf550ec (patch) | |
tree | 3d0d7bde43f8f7db5a3a75e54aa0a904b6c83eaf /server.py | |
parent | 04431658597c9b9ae489be3363c6b9478d946fcd (diff) | |
download | ezcms-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.py | 21 |
1 files changed, 3 insertions, 18 deletions
@@ -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) |