Load defaults from example config

This makes some options non-optional -- allowing for a smaller config file.
This also removes the X-Sendfile example, bucause the proxy server should
handle static files directly and the option is not at all specific to this
particular application (and general Flask options aren't documented).
This commit is contained in:
ShadowNinja
2016-01-23 23:47:15 -05:00
parent ebe788a156
commit a431911b9d
3 changed files with 10 additions and 10 deletions

View File

@@ -75,8 +75,8 @@ Setting up the server
# # OR:
# pip install uwsgi
4. Configure the server by changing options in config.py, which is a Flask
configuration file.
4. Configure the server by adding options to `config.py`.
See `config-example.py` for defaults.
5. Start the server:

View File

@@ -1,16 +1,12 @@
# Enables detailed tracebacks and an interactive Python console on errors.
# Never use in production!
#DEBUG = True
DEBUG = False
# Address for development server to listen on
#HOST = "127.0.0.1"
HOST = "127.0.0.1"
# Port for development server to listen on
#PORT = 5000
# Makes the server more performant at sending static files when the
# server is being proxied by a server that supports X-Sendfile.
#USE_X_SENDFILE = True
PORT = 5000
# File to store the JSON server list data in.
FILENAME = "list.json"

View File

@@ -10,7 +10,11 @@ sched = BackgroundScheduler(timezone="UTC")
sched.start()
app = Flask(__name__, static_url_path = "")
app.config.from_pyfile("config.py")
# Load configuration
app.config.from_pyfile("config-example.py") # Use example for defaults
if os.path.isfile(os.path.join(app.root_path, "config.py")):
app.config.from_pyfile("config.py")
@app.route("/")