-
Notifications
You must be signed in to change notification settings - Fork 1
/
webServerConf.py
51 lines (34 loc) · 1.32 KB
/
webServerConf.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from datetime import date, datetime
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
SQLOTE_MEMORY = 'sqlite:///:memory:'
app.config['SQLALCHEMY_DATABASE_URI'] = SQLOTE_MEMORY
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
web_db = SQLAlchemy(app)
class WebMessage(web_db.Model):
id = web_db.Column(web_db.Integer, primary_key=True)
text = web_db.Column(web_db.String())
timestamp = web_db.Column(web_db.DateTime, default=datetime.now)
def __init__(self, text):
self.text = text
def __repr__(self):
return '<Message: %r>' % self.text
class WebQrUrl(web_db.Model):
id = web_db.Column(web_db.Integer, primary_key=True)
url = web_db.Column(web_db.String())
timestamp = web_db.Column(web_db.DateTime, default=datetime.now)
def __init__(self, url):
self.url = url
def __repr__(self):
return '<QrUrl: %r>' % self.url
class UserInfo(web_db.Model):
id = web_db.Column(web_db.Integer, primary_key=True)
uid = web_db.Column(web_db.String())
status = web_db.Column(web_db.String())
timestamp = web_db.Column(web_db.DateTime, default=datetime.now)
def __init__(self, uid, status):
self.uid = uid
self.status = status
def __repr__(self):
return '<QrUrl: %r %r>' % (self.uid, self.status)