-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
33 lines (22 loc) · 543 Bytes
/
server.py
File metadata and controls
33 lines (22 loc) · 543 Bytes
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
from flask import Flask, render_template
from threading import Thread
import requests
import os
# loading env variables
try:
from dotenv import load_dotenv
load_dotenv()
except Exception as err:
print(err)
app = Flask(__name__)
@app.route("/")
def home():
data = requests.get(str(os.getenv("coin_api"))).json()
return render_template("index.html", data=data)
def run():
app.run(host="0.0.0.0", port=8080)
def runserver():
thd = Thread(target=run)
thd.start()
if __name__ == "__main__":
app.run()