예제 #1
0
def livereload():
    db.create_all()
    server = Server(app)
    server.watch("gather/*.py")
    server.watch("gather/templates/*.html")
    server.watch("gather/assets/stylesheets/*.sass")
    server.watch("gather/assets/javascripts/*.coffee")
    server.serve(port=8000)
예제 #2
0
def livereload():
    db.create_all()
    server = Server(app)
    server.watch("gather/*.py")
    server.watch("gather/templates/*.html")
    server.watch("gather/assets/stylesheets/*.sass")
    server.watch("gather/assets/javascripts/*.coffee")
    server.serve(port=8000)
예제 #3
0
파일: manage.py 프로젝트: gengxichao/Gather
def create_all():
    db.create_all()
예제 #4
0
파일: manage.py 프로젝트: jimmy0000/Gather
def create_all():
    db.create_all()
예제 #5
0
    for pbb_topic in mongo_database.topics.find(sort=[('last_reply_time', 1)]):
        topic = Topic(
            title=pbb_topic["title"],
            content=pbb_topic["content"],
            author=Account.query.filter_by(
                username=pbb_topic["author"].lower()).first(),
            node=Node.query.filter_by(slug=pbb_topic["node"]).first(),
            created=timestamp_to_datetime(pbb_topic["created"]),
            updated=timestamp_to_datetime(pbb_topic["last_reply_time"]))
        print "Migrating Topic %s by %s" % (topic.title, topic.author.username)
        db.session.add(topic)
        db.session.commit()
        for pbb_reply in mongo_database.replies.find(
            {'topic': str(pbb_topic["_id"])}, sort=[('index', 1)]):
            reply = Reply(content=pbb_reply["content"],
                          author=Account.query.filter_by(
                              username=pbb_reply["author"].lower()).first(),
                          topic=topic,
                          created=timestamp_to_datetime(pbb_reply["created"]))
            print "Migrating Reply %s by %s" % (reply.content,
                                                reply.author.username)

            db.session.add(reply)
        db.session.commit()


with app.app_context():
    db.drop_all()
    db.create_all()
    main()
예제 #6
0
    for pbb_topic in mongo_database.topics.find(sort=[('last_reply_time', 1)]):
        topic = Topic(
            title=pbb_topic["title"],
            content=pbb_topic["content"],
            author=Account.query.filter_by(username=pbb_topic["author"].lower()).first(),
            node=Node.query.filter_by(slug=pbb_topic["node"]).first(),
            created=timestamp_to_datetime(pbb_topic["created"]),
            updated=timestamp_to_datetime(pbb_topic["last_reply_time"])
        )
        print "Migrating Topic %s by %s" % (topic.title, topic.author.username)
        db.session.add(topic)
        db.session.commit()
        for pbb_reply in mongo_database.replies.find({'topic': str(pbb_topic["_id"])},
                                                     sort=[('index', 1)]):
            reply = Reply(
                content=pbb_reply["content"],
                author=Account.query.filter_by(username=pbb_reply["author"].lower()).first(),
                topic=topic,
                created=timestamp_to_datetime(pbb_reply["created"])
            )
            print "Migrating Reply %s by %s" % (reply.content, reply.author.username)

            db.session.add(reply)
        db.session.commit()


with app.app_context():
    db.drop_all()
    db.create_all()
    main()