Commit 57945ef4 authored by Kristian Tan's avatar Kristian Tan

Fixed imports

parent 59a9b3bc
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 daily_usage import DailyUsage import daily_usage
app = Flask(__name__) app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///energyUsage' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///energyUsage'
...@@ -11,7 +11,7 @@ db.create_all() ...@@ -11,7 +11,7 @@ db.create_all()
GPIO.setmode(GPIO.BCM) GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False) GPIO.setwarnings(False)
test = 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()
......
from app import db from app import db
class DailyUsage(db.Model): class DailyUsage(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True) id = db.Column(db.Integer, primary_key=True, autoincrement=True)
date = db.Column(db.String(80), unique=True, nullable=False) date = db.Column(db.String(80), unique=True, nullable=False)
......
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