Google Accounts for author authentication. Since it depends on MySQL, you
need to set up MySQL and the database schema for the demo to run.
+If you have `docker` and `docker-compose` installed, the demo and all
+its prerequisites can be installed with `docker-compose up`.
+
1. Install prerequisites and build tornado
See http://www.tornadoweb.org/ for installation instructions. If you can
# License for the specific language governing permissions and limitations
# under the License.
+import MySQLdb
import markdown
import os.path
import re
+import subprocess
import torndb
import tornado.auth
import tornado.httpserver
host=options.mysql_host, database=options.mysql_database,
user=options.mysql_user, password=options.mysql_password)
+ self.maybe_create_tables()
+
+ def maybe_create_tables(self):
+ try:
+ self.db.get("SELECT COUNT(*) from entries;")
+ except MySQLdb.ProgrammingError:
+ subprocess.check_call(['mysql',
+ '--host=' + options.mysql_host,
+ '--database=' + options.mysql_database,
+ '--user=' + options.mysql_user,
+ '--password=' + options.mysql_password],
+ stdin=open('schema.sql'))
+
class BaseHandler(tornado.web.RequestHandler):
@property