Beispiel #1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ${project_name}
from accost import WSGIApplication
from accost.cli import Command
from werkzeug import DebuggedApplication
origin = application = WSGIApplication(${project_name})
if ${project_name}.debug:
    application = DebuggedApplication(application, evalex=True)


if __name__ == '__main__':
    command = Command(application)
    command.register_app(origin)
    command.run()
Beispiel #2
0
            store.commit()

    def drop_user(username=''):
        store = models.store_manager.store
        user = store.find(models.User, models.User.username==unicode(username, 'utf-8')).one()
        if not user:
            print 'no such user:', username
            return
        store.find(models.PlayList, models.PlayList.user_id==user.id).remove()
        store.find(models.Channel, models.Channel.user_id==user.id).remove()
        store.find(models.Source, models.Source.user_id==user.id).remove()
        store.find(models.Order, models.Order.user_id==user.id).remove()
        store.find(models.NetSource, models.NetSource.user_id==user.id).remove()
        store.find(models.Directory, models.Directory.user_id==user.id).remove()
        store.find(models.Pipeline, models.Pipeline.user_id==user.id).remove()
        store.remove(user)
        try:
            store.flush()
        except:
            store.rollback()
        else:
            store.commit()

    from accost.cli import Command
    command = Command(application)
    command.register_app(origin)
    command.register(drop_user)
    command.register(create_super_user)
    command.register(clear)
    command.run()