From 06c9e9357ad3106c50e3a6b1570c58ce942f7a1a Mon Sep 17 00:00:00 2001 From: mattbk Date: Sat, 9 Dec 2017 04:28:16 +0000 Subject: [PATCH] Add port to config file. --- config.ini | 2 ++ pi_temp.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 config.ini diff --git a/config.ini b/config.ini new file mode 100644 index 0000000..d6b9c61 --- /dev/null +++ b/config.ini @@ -0,0 +1,2 @@ +[DEFAULT] +PORT = 8080 \ No newline at end of file diff --git a/pi_temp.py b/pi_temp.py index 3a22172..e0ff418 100755 --- a/pi_temp.py +++ b/pi_temp.py @@ -51,8 +51,13 @@ import arrow import json import plotly import sqlite3 +import ConfigParser from plotly.graph_objs import * +config = ConfigParser.ConfigParser() +config.read("config.ini") +port = config.getint('DEFAULT', 'PORT') + app = Flask(__name__) app.debug = True # Make this False if you are no longer debugging @@ -217,4 +222,4 @@ def validate_date(d): return False if __name__ == "__main__": - app.run(host='0.0.0.0', port=8080) + app.run(host='0.0.0.0', port=port)