Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IoTSmartMeter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kristian.tan
IoTSmartMeter
Commits
55db7124
Commit
55db7124
authored
Nov 12, 2019
by
Kristian Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
access dailyUsage
parent
11a4b89c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
app.py
app.py
+6
-0
No files found.
app.py
View file @
55db7124
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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment