service.py

changeset 30
a5bfd99bc2a3
parent 29
2c78e68d7363
child 31
60045b362d71
equal deleted inserted replaced
29:2c78e68d7363 30:a5bfd99bc2a3
5 from configparser import ConfigParser 5 from configparser import ConfigParser
6 import locale 6 import locale
7 7
8 from misc import * 8 from misc import *
9 from busroute import reduce_schedule 9 from busroute import reduce_schedule
10 import buses
10 11
11 app = Flask(__name__) 12 app = Flask(__name__)
12 13
13 # Varmista ettei järjestelmän kieliasetukset sotke muotoiluja 14 # Varmista ettei järjestelmän kieliasetukset sotke muotoiluja
14 def reset_locale(): 15 def reset_locale():
218 219
219 @app.route('/static/<path:path>') 220 @app.route('/static/<path:path>')
220 def static_file(path): 221 def static_file(path):
221 return send_from_directory(path.join('static', path)) 222 return send_from_directory(path.join('static', path))
222 223
224 from argparse import ArgumentParser
225 parser = ArgumentParser()
226 parser.add_argument('gtfs_zip_path')
227 parser.add_argument('profile_path')
228
223 if __name__ == '__main__': 229 if __name__ == '__main__':
224 from argparse import ArgumentParser
225 parser = ArgumentParser()
226 parser.add_argument('-p', '--port', type = int, default = 5000) 230 parser.add_argument('-p', '--port', type = int, default = 5000)
227 parser.add_argument('-d', '--debug', action = 'store_true') 231 parser.add_argument('-d', '--debug', action = 'store_true')
228 args = parser.parse_args() 232
233 args = parser.parse_args()
234 profile = ConfigParser()
235 profile.read(args.profile_path)
236 buses.load_buses(args.gtfs_zip_path, profile = profile)
237
238 if __name__ == '__main__':
229 app.run(debug = args.debug, port = args.port) 239 app.run(debug = args.debug, port = args.port)

mercurial