Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import time
from w1thermsensor import W1ThermSensor
from flask import Flask
from flask import render_template
import socket
app = Flask(__name__)
def Temperature():
sensor = W1ThermSensor()
temperature = sensor.get_temperature()
return temperature
def WebpageSet(temp):
W = open("\Templates\index.html", "w")
F = open("First.txt", "r")
L = open("Last.txt", "r")
W.write(F.read() + str(temp) + L.read())
print("TEST")
F.close()
L.close()
W.close()
temp = 25
W = open("Templates\index.html", "w")
F = open("First.txt", "r")
L = open("Last.txt", "r")
W.write(F.read() + str(temp) + L.read())
print("TEST")
F.close()
L.close()
W.close()
def get_ip_address():
ip_address = '';
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8",80))
ip_address = s.getsockname()[0]
s.close()
return ip_address
@app.route("/")
def index():
WebpageSet(25)
return render_template('index.html')
if __name__ == '__main__':
#app.run(threaded=True)
#app.debug = True
app.run(host = get_ip_address())