Add a configuration file
This commit is contained in:
parent
a8f8590c5a
commit
bf4bc4c06a
7
config.py
Normal file
7
config.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# database = ":memory:"
|
||||||
|
database = "dev.db"
|
||||||
|
|
||||||
|
host = "localhost"
|
||||||
|
port = 8080
|
||||||
|
|
||||||
|
production = False
|
6
main.py
6
main.py
@ -3,13 +3,13 @@ import bottle
|
|||||||
from bottle.ext import sqlalchemy
|
from bottle.ext import sqlalchemy
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
|
|
||||||
|
import config
|
||||||
import database
|
import database
|
||||||
import routes
|
import routes
|
||||||
import tools
|
import tools
|
||||||
|
|
||||||
# Initialize db and include the SQLAlchemy plugin in bottle
|
# Initialize db and include the SQLAlchemy plugin in bottle
|
||||||
# engine = create_engine('sqlite:///:memory:', echo=True)
|
engine = create_engine('sqlite:///%s' % (config.database,), echo=True)
|
||||||
engine = create_engine('sqlite:///dev.db', echo=True)
|
|
||||||
|
|
||||||
app = bottle.Bottle()
|
app = bottle.Bottle()
|
||||||
plugin = sqlalchemy.Plugin(
|
plugin = sqlalchemy.Plugin(
|
||||||
@ -59,4 +59,4 @@ app.route("/papers/<id:int>/relationships/<name>", method="PATCH",
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host='localhost', port=8080, debug=True)
|
app.run(host=config.host, port=config.port, debug=(not config.production))
|
||||||
|
Loading…
Reference in New Issue
Block a user