Download:
child 31:408a5c993107
parent 29:716c65abb699
30:e1e43c8390b9
Anton Shestakov <engored@ya.ru>, Fri, 11 Jan 2013 19:10:31 +0900
Use @app.before_first_request instead of calling init_db() explicitly (so autogenerated wsgi.py files will just work).

2 файлов изменено, 2 вставок(+), 3 удалений(-) [+]
app.py file | annotate | diff | comparison | revisions
test.py file | annotate | diff | comparison | revisions
--- a/app.py Fri Jan 11 17:34:22 2013 +0900
+++ b/app.py Fri Jan 11 19:10:31 2013 +0900
@@ -20,6 +20,7 @@
cdb = None
+@app.before_first_request
def init_db():
global cdb
@@ -85,5 +86,4 @@
if __name__ == '__main__':
- init_db()
app.run()
--- a/test.py Fri Jan 11 17:34:22 2013 +0900
+++ b/test.py Fri Jan 11 19:10:31 2013 +0900
@@ -5,7 +5,7 @@
from itertools import chain
from unittest import TestCase, main
-from app import app, init_db
+from app import app
class BaseTestCase(TestCase):
@@ -127,5 +127,4 @@
if __name__ == '__main__':
app.config['TESTING'] = True
app.config['DATABASE'] = 'test_db'
- init_db()
main()