
from __future__ import print_function

import os

from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand

from app import create_app, db


application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = Manager(application)
manager.add_command("runserver", Server(port=5000))
migrate = Migrate(application, db)
manager.add_command('db', MigrateCommand)


@manager.command
def list_routes():
    """List URLs of all application routes."""
    for rule in sorted(application.url_map.iter_rules(), key=lambda r: r.rule):
        print("{:10} {}".format(", ".join(rule.methods - set(['OPTIONS', 'HEAD'])), rule.rule))

if __name__ == '__main__':
    manager.run()


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()

Use new dmutils init_manager to set up reload on schema changes
Use new dmutils init_manager to set up reload on schema changes

  
  from __future__ import print_function
  
  import os
  
- from flask.ext.script import Manager, Server
+ 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 = Manager(application)
- manager.add_command("runserver", Server(port=5000))
+ manager = init_manager(application, 5000, ['./json_schemas'])
+ 
  migrate = Migrate(application, db)
  manager.add_command('db', MigrateCommand)
  
  
- @manager.command
- def list_routes():
-     """List URLs of all application routes."""
-     for rule in sorted(application.url_map.iter_rules(), key=lambda r: r.rule):
-         print("{:10} {}".format(", ".join(rule.methods - set(['OPTIONS', 'HEAD'])), rule.rule))
- 
  if __name__ == '__main__':
      manager.run()
  
Use new dmutils init_manager to set up reload on schema changes
## Code Before:

from __future__ import print_function

import os

from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand

from app import create_app, db


application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = Manager(application)
manager.add_command("runserver", Server(port=5000))
migrate = Migrate(application, db)
manager.add_command('db', MigrateCommand)


@manager.command
def list_routes():
    """List URLs of all application routes."""
    for rule in sorted(application.url_map.iter_rules(), key=lambda r: r.rule):
        print("{:10} {}".format(", ".join(rule.methods - set(['OPTIONS', 'HEAD'])), rule.rule))

if __name__ == '__main__':
    manager.run()

## Instruction:
Use new dmutils init_manager to set up reload on schema changes
## Code After:

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()
