Skip to content

Commit c728234

Browse files
committed
Allow configure without running for uWSGI.
1 parent 5088f89 commit c728234

File tree

1 file changed

+14
-1
lines changed
  • app/ch15_deploy/final/pypi_org

1 file changed

+14
-1
lines changed

app/ch15_deploy/final/pypi_org/app.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33

44
import flask
5+
56
folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
67
sys.path.insert(0, folder)
78
import pypi_org.data.db_session as db_session
@@ -10,9 +11,19 @@
1011

1112

1213
def main():
14+
configure()
15+
app.run(debug=True, port=5006)
16+
17+
18+
def configure():
19+
print("Configuring Flask app:")
20+
1321
register_blueprints()
22+
print("Registered blueprints")
23+
1424
setup_db()
15-
app.run(debug=True, port=5006)
25+
print("DB setup completed.")
26+
print("", flush=True)
1627

1728

1829
def setup_db():
@@ -40,3 +51,5 @@ def register_blueprints():
4051

4152
if __name__ == '__main__':
4253
main()
54+
else:
55+
configure()

0 commit comments

Comments
 (0)