diff --git a/README.md b/README.md index f211de6..87f2518 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/config-example.py b/config-example.py index ee4782c..bf87b70 100644 --- a/config-example.py +++ b/config-example.py @@ -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" diff --git a/server.py b/server.py index c9f5cdc..9775275 100755 --- a/server.py +++ b/server.py @@ -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("/")