コード例 #1
0
#!/usr/bin/env python

from __future__ import print_function

import os

from dmutils import init_manager
from flask.ext.migrate import Migrate, MigrateCommand

from app import create_app, db


application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = init_manager(application, 5000, ['./json_schemas'])

migrate = Migrate(application, db)
manager.add_command('db', MigrateCommand)


if __name__ == '__main__':
    manager.run()
コード例 #2
0
#!/usr/bin/env python

import os
from app import create_app
from dmutils import init_manager

application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = init_manager(application, 5007)

if __name__ == '__main__':
    manager.run()
コード例 #3
0
#!/usr/bin/env python

import os
import re
from app import create_app
from dmutils import init_manager

application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
application.jinja_options = {'extensions': ['jinja2.ext.with_']}

manager = init_manager(application, 5003, ['./app/content/frameworks'])

if __name__ == '__main__':
    manager.run()
コード例 #4
0
#!/usr/bin/env python

import os
import re
from app import create_app
from dmutils import init_manager

application = create_app(
    os.getenv('DM_ENVIRONMENT') or 'development'
)
application.jinja_options = {
    'extensions': [
        'jinja2.ext.with_'
    ]
}

manager = init_manager(application, 5003, ['./app/content/frameworks'])

if __name__ == '__main__':
    manager.run()
コード例 #5
0
#!/usr/bin/env python

from __future__ import print_function

import os

from dmutils import init_manager
from flask.ext.migrate import Migrate, MigrateCommand

from app import create_app, db

application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = init_manager(application, 5000, ['./json_schemas'])

migrate = Migrate(application, db)
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()
コード例 #6
0
#!/usr/bin/env python

import os
import sys
from app import create_app
from dmutils import init_manager


port = int(os.getenv('PORT', '5001'))
application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = init_manager(application, port, [])

@manager.command
def update_index(index_name):
    from app.main.services.search_service import create_index
    with application.app_context():
        application.logger.info("Creating index %s", index_name)
        message, status = create_index(index_name)
    assert status == 200, message
    application.logger.info("Created index %s", index_name)

application.logger.info('Command line: {}'.format(sys.argv))

if __name__ == '__main__':
    try:
        application.logger.info('Running manager')
        manager.run()
    finally:
        application.logger.info('Manager finished')