From bf4bc4c06a54aff6ca2f6096aa4942b0c8a26af5 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Fri, 25 Dec 2015 20:11:56 +0100 Subject: [PATCH] Add a configuration file --- config.py | 7 +++++++ main.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 config.py diff --git a/config.py b/config.py new file mode 100644 index 0000000..d1c6e41 --- /dev/null +++ b/config.py @@ -0,0 +1,7 @@ +# database = ":memory:" +database = "dev.db" + +host = "localhost" +port = 8080 + +production = False diff --git a/main.py b/main.py index b3f6494..4bbab3c 100755 --- a/main.py +++ b/main.py @@ -3,13 +3,13 @@ import bottle from bottle.ext import sqlalchemy from sqlalchemy import create_engine +import config import database import routes import tools # Initialize db and include the SQLAlchemy plugin in bottle -# engine = create_engine('sqlite:///:memory:', echo=True) -engine = create_engine('sqlite:///dev.db', echo=True) +engine = create_engine('sqlite:///%s' % (config.database,), echo=True) app = bottle.Bottle() plugin = sqlalchemy.Plugin( @@ -59,4 +59,4 @@ app.route("/papers//relationships/", method="PATCH", if __name__ == "__main__": - app.run(host='localhost', port=8080, debug=True) + app.run(host=config.host, port=config.port, debug=(not config.production))