From 6ddd97e1c39f55fe60fca093ca4fe610eca6d462 Mon Sep 17 00:00:00 2001 From: mjfernez Date: Wed, 25 Aug 2021 20:05:00 -0400 Subject: Clarify siteconfig This clarifies what the MAIN_SITE_DIRS option means since one might read it to mean you can put your directories anywhere. Not so, you can only pick which dirs are displayed with that option. Also recommends to not use the secret key unless needed (for what reason, I don't know). --- server.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'server.py') diff --git a/server.py b/server.py index ea04690..1908ad3 100644 --- a/server.py +++ b/server.py @@ -6,6 +6,7 @@ app = Flask(__name__) from views import * + def setup(): """ setup - sets up the app according to the settings specified (or not @@ -20,21 +21,18 @@ def setup(): if siteconfig.MAIN_SITE_DIRS: app.config.update({'MAIN_SITE_DIRS': siteconfig.MAIN_SITE_DIRS}) else: - s = './templates/site/' + s = "./templates/site/" top_dirs = [ x for x in os.listdir(s) \ - if os.path.isdir(s + x) and not x.startswith('.') + if os.path.isdir(s + x) and not x.startswith(".") ] - app.config.update( - { - 'MAIN_SITE_DIRS': sorted(top_dirs) - } - ) + app.config.update({'MAIN_SITE_DIRS': sorted(top_dirs)}) app.config.update({'DOMAIN': siteconfig.DOMAIN}) app.config.update({'HOME_TITLE': siteconfig.HOME_TITLE}) + # Setup needs to come first to be compatible with wsgi setup() -if __name__ == '__main__': +if __name__ == "__main__": app.run() -- cgit v1.2.3