Exemplo n.º 1
0
#!/usr/bin/env python
#coding=utf-8

import uuid

from flask import Flask, current_app
from flask.ext.script import Server, Shell, Manager, Command, prompt_bool

from transviewer import create_app
from transviewer.extensions import db
from transviewer.models import Episode, Scene, Speech
from scripts import parse_trans

#manager = Manager(create_app(config_obj='transviewer.config.DevelopmentConfig'))
manager = Manager(create_app(config_obj='transviewer.config.ProductionConfig'))
manager.add_command("runserver", Server('0.0.0.0',port=5000))

def _make_context():
    return dict(db=db)
manager.add_command("shell", Shell(make_context=_make_context))

@manager.command
def createall():
    "Creates database tables"
    db.create_all()

import codecs
def populate_tbbt(sn, ep, title):
    if Episode.query.filter_by(season=sn, episode=ep).first():
        return;
    filename = 's%02de%02d' % (sn, ep)
Exemplo n.º 2
0
# -*- coding: utf-8 -*- 
import os
from transviewer import create_app

app = create_app()

if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0',port=port,debug=True)