forked from SamPom100/UnusualVolumeDetector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebsite_generator.py
48 lines (40 loc) · 1.48 KB
/
website_generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import flask
from flask_flatpages import FlatPages
from flask_frozen import Freezer
from flask import Flask, request, send_from_directory, render_template
from shutil import copyfile
import os
import shutil
import numpy
from market_scanner import mainObj
# this is used by me AUTOMATICALLY to update the web page you can find at: https://sampom100.github.io/UnusualVolumeDetector/
app = flask.Flask(__name__, static_url_path='')
app.config["DEBUG"] = False
app.config['SECRET_KEY'] = 'deditaded wam'
pages = FlatPages(app)
freezer = Freezer(app)
@app.after_request
def after_request(response):
response.headers.add('Access-Control-Allow-Origin', 'localhost*,192.168.*')
response.headers.add('Access-Control-Allow-Headers',
'Content-Type,Authorization')
response.headers.add('Access-Control-Allow-Methods',
'GET,PUT,POST,DELETE,OPTIONS')
return response
@app.route('/', methods=['GET'])
def home():
return render_template('template.html', stonks=stonks)
if __name__ == "__main__":
os.system('git fetch')
stonk_search = mainObj()
stonks = stonk_search.main_func()
freezer.freeze()
copyfile('build/index.html', 'index.html')
shutil.rmtree('build/')
# I'm lazy :)
os.system('git add .')
os.system('git commit -m "updated website"')
os.system('git push origin master')
# print(stonks)
# app.run(host='0.0.0.0', port='5000') # run the app on LAN
# app.run() # run the app on your machine