Customizable db path in server
This commit is contained in:
parent
e65be07fc1
commit
b097bc2d2a
@ -59,6 +59,9 @@ adapt its behavior:
|
||||
* `HOST=` to specify the host to listen to (defaults to `127.0.0.1` which
|
||||
means `localhost` only).
|
||||
* `PORT=` to specify the port to listen on (defaults to `8081`).
|
||||
* `DATABASE=` to specify a [database URL](http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#db-url) to connect to (defaults to
|
||||
`sqlite:///reports.db` which means a SQLite database named `reports.db` in
|
||||
the current working directory).
|
||||
|
||||
### Serving
|
||||
|
||||
|
@ -3,11 +3,14 @@
|
||||
"""
|
||||
Models and database definition
|
||||
"""
|
||||
import os
|
||||
|
||||
import arrow
|
||||
import peewee
|
||||
from playhouse.db_url import connect
|
||||
from playhouse.shortcuts import model_to_dict
|
||||
|
||||
db = peewee.SqliteDatabase('reports.db')
|
||||
db = connect(os.environ.get('DATABASE', 'sqlite:///reports.db'))
|
||||
|
||||
|
||||
class BaseModel(peewee.Model):
|
||||
|
Loading…
Reference in New Issue
Block a user