aboutsummaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
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)