]> git.cworth.org Git - turbot/commitdiff
Convert "make run" to use "flask run" instead of direct python script execution
authorCarl Worth <cworth@cworth.org>
Tue, 29 Sep 2020 15:35:46 +0000 (08:35 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 29 Sep 2020 15:35:46 +0000 (08:35 -0700)
This will simplify some future work (regarding reorganizing the code into
a package, etc.) so that we don't have to try to simultaneously support
running as both a script and as a module.

Makefile
turbot.py

index 5199e6ae4317f99c1fa3f40e761ac003070dce31..d38a9a984c71be5bb68e37f30c1f122667659ece 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ endif
        pip-compile --no-index --generate-hashes --allow-unsafe
 
 run: require-venv
-       python3 ./turbot.py
+       FLASK_APP=turbot FLASK_DEBUG=true flask run
 
 turbot.wsgi: turbot.wsgi.in Makefile
        envsubst < turbot.wsgi.in > turbot.wsgi
index 7371dc2ace556b8f5d1a361074096c9685d4ceca..5095d2a39de779b82f5879a00c062b112a7bb753 100755 (executable)
--- a/turbot.py
+++ b/turbot.py
@@ -103,6 +103,3 @@ def rot():
 @slack_events.on("error")
 def handle_error(error):
     app.logger.error("Error from Slack: " + str(error))
-
-if __name__ == '__main__':
-    app.run(debug=True)