Add a configuration file

This commit is contained in:
Lucas Verney 2015-12-25 20:11:56 +01:00
parent a8f8590c5a
commit bf4bc4c06a
2 changed files with 10 additions and 3 deletions

7
config.py Normal file
View File

@ -0,0 +1,7 @@
# database = ":memory:"
database = "dev.db"
host = "localhost"
port = 8080
production = False

View File

@ -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/<id:int>/relationships/<name>", 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))