SQLite compatibility

pull/6/head
Yax 10 years ago
parent 612fb85fa3
commit 809d46730e

1
.gitignore vendored

@ -58,3 +58,4 @@ target/
# My ignored files and directories # My ignored files and directories
myconfig.json myconfig.json
db.sqlite

@ -26,7 +26,7 @@ def query_comments():
logger.info('retrieve comments for token %s, url %s' % (token, url)) logger.info('retrieve comments for token %s, url %s' % (token, url))
for comment in Comment.select(Comment).join(Site).where( for comment in Comment.select(Comment).join(Site).where(
(Comment.url == url) & (Comment.url == url) &
(Site.token == token)).order_by(Comment.published): (Site.token == token)).order_by(+Comment.published):
d = {} d = {}
d['author'] = comment.author_name d['author'] = comment.author_name
d['content'] = comment.content d['content'] = comment.content
@ -35,6 +35,7 @@ def query_comments():
if comment.author_email: if comment.author_email:
d['avatar'] = md5(comment.author_email.strip().lower()) d['avatar'] = md5(comment.author_email.strip().lower())
d['date'] = comment.published.strftime("%Y-%m-%d %H:%M:%S") d['date'] = comment.published.strftime("%Y-%m-%d %H:%M:%S")
logger.info(d)
comments.append(d) comments.append(d)
r = jsonify({'data': comments}) r = jsonify({'data': comments})
r.status_code = 200 r.status_code = 200

@ -2,7 +2,8 @@
DEBUG = True DEBUG = True
DB_URL = "mysql://stacosys_user:stacosys_password@localhost:3306/stacosys" #DB_URL = "mysql://stacosys_user:stacosys_password@localhost:3306/stacosys"
DB_URL = "sqlite:///db.sqlite"
HTTP_ADDRESS = "0.0.0.0" HTTP_ADDRESS = "0.0.0.0"
HTTP_PORT = 8000 HTTP_PORT = 8000

Loading…
Cancel
Save