Commit 55db7124 authored by Kristian Tan's avatar Kristian Tan

access dailyUsage

parent 11a4b89c
from flask import Flask, render_template from flask import Flask, render_template
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import create_engine
import os
import daily_usage import daily_usage
app = Flask(__name__) app = Flask(__name__)
...@@ -10,6 +12,10 @@ db.create_all() ...@@ -10,6 +12,10 @@ db.create_all()
GPIO.setmode(GPIO.BCM) GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False) GPIO.setwarnings(False)
engine = create_engine(os.environ['SQLALCHEMY_DATABASE_URI'])
daily_usage.DailyUsage.metadata.createall()
test = daily_usage.DailyUsage("12/11/2019", 5) test = daily_usage.DailyUsage("12/11/2019", 5)
db.session.add(test) db.session.add(test)
db.session.commit() db.session.commit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment