-
Notifications
You must be signed in to change notification settings - Fork 78
/
run.py
35 lines (26 loc) · 922 Bytes
/
run.py
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
# -*- coding: utf-8 -*-
"""
Eve Demo
~~~~~~~~
A demostration of a simple API powered by Eve REST API.
The live demo is available at eve-demo.herokuapp.com. Please keep in mind
that the it is running on Heroku's free tier using a free MongoHQ
sandbox, which means that the first request to the service will probably
be slow. The database gets a reset every now and then.
:copyright: (c) 2016 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
import os
from eve import Eve
# Heroku support: bind to PORT if defined, otherwise default to 5000.
if 'PORT' in os.environ:
port = int(os.environ.get('PORT'))
# use '0.0.0.0' to ensure your REST API is reachable from all your
# network (and not only your computer).
host = '0.0.0.0'
else:
port = 5000
host = '127.0.0.1'
app = Eve()
if __name__ == '__main__':
app.run(host=host, port=port)