comparison foodtruck/main.py @ 772:3885421c29a3

admin: Make the whole FoodTruck site into a blueprint. This makes it possible to use an app factory, which makes it easier to write unit tests.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 03 Jul 2016 07:54:54 -0700
parents 200c7063affa
children
comparison
equal deleted inserted replaced
771:673979a5d548 772:3885421c29a3
7 def run_foodtruck(host=None, port=None, debug=False): 7 def run_foodtruck(host=None, port=None, debug=False):
8 if debug: 8 if debug:
9 import foodtruck.settings 9 import foodtruck.settings
10 foodtruck.settings.DEBUG = debug 10 foodtruck.settings.DEBUG = debug
11 11
12 from .web import app 12 from .web import create_foodtruck_app
13 try: 13 try:
14 app = create_foodtruck_app()
14 app.run(host=host, port=port, debug=debug, threaded=True) 15 app.run(host=host, port=port, debug=debug, threaded=True)
15 except SystemExit: 16 except SystemExit:
16 # This is needed for Werkzeug's code reloader to be able to correctly 17 # This is needed for Werkzeug's code reloader to be able to correctly
17 # shutdown the child process in order to restart it (otherwise, SSE 18 # shutdown the child process in order to restart it (otherwise, SSE
18 # generators will keep it alive). 19 # generators will keep it alive).