Esempio n. 1
0
def main():
    if options.debug:
        # Development config
        define('setting', '/Users/messense/config/messense.conf')
    else:
        define('setting', '')
    tornado.options.parse_command_line()
    parse_config_file(options.setting)
    server = HTTPServer(Application(), xheaders=True)
    server.listen(int(options.port))
    IOLoop.instance().start()
Esempio n. 2
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import argparse
import config
from tornado.options import options
# import app
import sys
default_encoding = 'utf-8'
if sys.getdefaultencoding() != default_encoding:
    reload(sys)
    sys.setdefaultencoding(default_encoding)

from lib.util import parse_config_file

parse_config_file("/Users/messense/config/messense.conf")


def create_db():
    from lib.database import db
    import models
    db.create_db()
    return


def export():
    from models import Post
    import os
    from os import path
    posts = Post.query.all()
    print("%s posts to be exported." % len(posts))
    if not path.exists('%s/md' % config.PROJDIR):