From a27797d29b77e00d3de783ff710f5a495472d5e1 Mon Sep 17 00:00:00 2001 From: ymkymkymkymx <43044797+ymkymkymkymx@users.noreply.github.com> Date: Fri, 30 Oct 2020 16:51:10 -0400 Subject: [PATCH] try to push to heroku --- Procfile | 2 ++ number.txt | 1 + number1.txt | 1 + requirements.txt | 10 ++++++++++ scanandshow.py | 17 +++++++++++++++++ taskrunner.py | 26 ++++++++++++++++++++++++++ templates/index.html | 18 ++++++++++++++++++ templates/index.txt | 18 ++++++++++++++++++ templates/time.html | 18 ++++++++++++++++++ templates/time.txt | 18 ++++++++++++++++++ templates/weather.html | 18 ++++++++++++++++++ templates/weather.txt | 18 ++++++++++++++++++ 12 files changed, 165 insertions(+) create mode 100644 Procfile create mode 100644 number.txt create mode 100644 number1.txt create mode 100644 requirements.txt create mode 100644 scanandshow.py create mode 100644 taskrunner.py create mode 100644 templates/index.html create mode 100644 templates/index.txt create mode 100644 templates/time.html create mode 100644 templates/time.txt create mode 100644 templates/weather.html create mode 100644 templates/weather.txt diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..068a07f --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +clock: python taskrunner.py +webapp: python scanandshow.py \ No newline at end of file diff --git a/number.txt b/number.txt new file mode 100644 index 0000000..b6be878 --- /dev/null +++ b/number.txt @@ -0,0 +1 @@ +14.4258752 \ No newline at end of file diff --git a/number1.txt b/number1.txt new file mode 100644 index 0000000..ee37107 --- /dev/null +++ b/number1.txt @@ -0,0 +1 @@ +14.4278076 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..74aa7e0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +click==7.1.2 +Flask==1.1.1 +gunicorn==20.0.4 +itsdangerous==1.1.0 +Jinja2==2.11.2 +MarkupSafe==1.1.1 +Werkzeug==1.0.1 +requests==2.22.0 +psycopg2==2.8.2 +APScheduler==3.0.0 \ No newline at end of file diff --git a/scanandshow.py b/scanandshow.py new file mode 100644 index 0000000..e35e392 --- /dev/null +++ b/scanandshow.py @@ -0,0 +1,17 @@ +from flask import Flask, render_template, request +import requests as apirequest +app = Flask(__name__) +key="" +weatherkey="" +@app.route('/') +def index(): + f=open("number.txt",'r') + num=f.readline() + f.close() + return render_template('time.html', number=num) +if __name__ == '__main__': + app.run( + host="0.0.0.0", + port=80 + ) + diff --git a/taskrunner.py b/taskrunner.py new file mode 100644 index 0000000..abd5177 --- /dev/null +++ b/taskrunner.py @@ -0,0 +1,26 @@ +from apscheduler.schedulers.blocking import BlockingScheduler +import time +sched = BlockingScheduler() + + + + +@sched.scheduled_job('interval', seconds=3) +def timed_job1(): + f=open("number.txt","w") + num=time.clock() + num=str(num) + f.write(num) + f.close() + print('This job is run every three seconds.') + +@sched.scheduled_job('interval', seconds=3) +def timed_job2(): + f=open("number1.txt","w") + num=time.clock() + num=str(num) + f.write(num) + f.close() + print('This job is run every three seconds.') + +sched.start() diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..3a4e297 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,18 @@ + + +
+ + + +