-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
35 lines (28 loc) · 859 Bytes
/
app.py
File metadata and controls
35 lines (28 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from apistar import Include, Route
from apistar.frameworks.wsgi import WSGIApp as App
from apistar.handlers import docs_urls, static_urls
from apistar.backends import sqlalchemy_backend
from db.models import Base
from api import routes
def welcome(name=None):
if name is None:
return {'message': 'Welcome to db Star!'}
return {'message': 'Welcome to db Star, %s!' % name}
routes = routes + \
[
Include('/docs', docs_urls),
Include('/static', static_urls)
]
# Configure database settings
settings = {
"DATABASE": {
"URL": "sqlite:///Test.db",
"METADATA": Base.metadata
}
}
app = App(routes=routes,
settings=settings,
commands=sqlalchemy_backend.commands,
components=sqlalchemy_backend.components)
if __name__ == '__main__':
app.main()