示例#1
0
from duproxy import application
from duproxy import api
from duproxy.core import db
from duproxy.models import FileStore
from flask.ext.sqlalchemy import SQLAlchemy
app = api.create_app()
db.init_app(app)
with app.test_request_context():
    db.create_all()

示例#2
0
from duproxy import api

if __name__ == "__main__":
    api.create_app().run('0.0.0.0', debug=True)
示例#3
0
import os
import hashlib
import shutil

from celery.utils.log import get_task_logger
from celery.signals import task_postrun
from flask import current_app

from duproxy import api
from .core import db
from .application import create_celery_app
from .services import filestores

logger = get_task_logger(__name__)

celery = create_celery_app(current_app or api.create_app('local_settings'))


if __name__ == '__main__':
    celery.start()


@celery.task()
def upload_filestore(g_id, md5, new_file_path):
    return filestores.create(g_id=g_id,
                             md5=md5,
                             local_path=new_file_path).to_dict


@celery.task(ignore_result=True)
def update_filestore(dir_path, id_md5, g_id, md5):
示例#4
0
#!/usr/bin/env python
from flask.ext.script import Manager

from duproxy import api
from duproxy.core import db

app = api.create_app('local_settings')
manager = Manager(app)


@manager.command
def init_db():
    db.create_all()


if __name__ == "__main__":
    manager.run()
示例#5
0
 def _create_app(self):
     return create_app(settings)