from flask.ext.script import Manager

from datawire.core import app, db
from datawire.model import Service
from datawire.views import index

manager = Manager(app)


@manager.command
def create_db():
    """ Create the database entities. """
    db.create_all()


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

from flask.ext.script import Manager

from datawire.core import app, db
from datawire.model import User
from datawire.views import index

manager = Manager(app)


@manager.command
def createdb():
    """ Create the database entities. """
    db.create_all()
    admin_data = {'screen_name': 'admin', 'display_name': 'Systems Admin'}
    if User.by_screen_name(admin_data.get('screen_name')) is None:
        admin = User.create(admin_data)
    db.session.commit() 


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

Create an admin user on db initialisation.
Create an admin user on db initialisation. 
  from flask.ext.script import Manager
  
  from datawire.core import app, db
- from datawire.model import Service
+ from datawire.model import User
  from datawire.views import index
  
  manager = Manager(app)
  
  
  @manager.command
- def create_db():
+ def createdb():
      """ Create the database entities. """
      db.create_all()
+     admin_data = {'screen_name': 'admin', 'display_name': 'Systems Admin'}
+     if User.by_screen_name(admin_data.get('screen_name')) is None:
+         admin = User.create(admin_data)
+     db.session.commit() 
  
  
  if __name__ == "__main__":
      manager.run()
  
Create an admin user on db initialisation.
## Code Before:
from flask.ext.script import Manager

from datawire.core import app, db
from datawire.model import Service
from datawire.views import index

manager = Manager(app)


@manager.command
def create_db():
    """ Create the database entities. """
    db.create_all()


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

## Instruction:
Create an admin user on db initialisation.
## Code After:
from flask.ext.script import Manager

from datawire.core import app, db
from datawire.model import User
from datawire.views import index

manager = Manager(app)


@manager.command
def createdb():
    """ Create the database entities. """
    db.create_all()
    admin_data = {'screen_name': 'admin', 'display_name': 'Systems Admin'}
    if User.by_screen_name(admin_data.get('screen_name')) is None:
        admin = User.create(admin_data)
    db.session.commit() 


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