From 809d46730e46fe844ad530e3c17e2c62f524b2b1 Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Mon, 4 May 2015 20:01:47 +0200 Subject: [PATCH] SQLite compatibility --- .gitignore | 1 + app/controllers/api.py | 3 ++- config.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index faac339..a590a7a 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ target/ # My ignored files and directories myconfig.json +db.sqlite diff --git a/app/controllers/api.py b/app/controllers/api.py index 287712f..50004b6 100644 --- a/app/controllers/api.py +++ b/app/controllers/api.py @@ -26,7 +26,7 @@ def query_comments(): logger.info('retrieve comments for token %s, url %s' % (token, url)) for comment in Comment.select(Comment).join(Site).where( (Comment.url == url) & - (Site.token == token)).order_by(Comment.published): + (Site.token == token)).order_by(+Comment.published): d = {} d['author'] = comment.author_name d['content'] = comment.content @@ -35,6 +35,7 @@ def query_comments(): if comment.author_email: d['avatar'] = md5(comment.author_email.strip().lower()) d['date'] = comment.published.strftime("%Y-%m-%d %H:%M:%S") + logger.info(d) comments.append(d) r = jsonify({'data': comments}) r.status_code = 200 diff --git a/config.py b/config.py index 00c8647..9777272 100644 --- a/config.py +++ b/config.py @@ -2,7 +2,8 @@ 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_PORT = 8000