old_contents: #!/usr/bin/env python
  from app.hermes.models import init_db, pop_db
  from os.path import abspath
  from flask import current_app as app
  from app import create_app, db
  from flask.ext.script import Manager
  
  manager = Manager(create_app)
  manager.add_option('-m', '--cfgmode', dest='config_mode',
  	default='Development')
  manager.add_option('-f', '--cfgfile', dest='config_file', type=abspath)
  
  site = 'http://127.0.0.1:5000/api'
  
  
  @manager.command
  def createdb():
  	with app.app_context():
  
  		"""Creates database if it doesn't already exist"""
  		db.create_all()
  		print 'Database created'
  
  
  @manager.command
  def cleardb():
  	with app.app_context():
  
  		"""Removes all content from database"""
  		db.drop_all()
  		print 'Database cleared'
  
  
  @manager.command
  def resetdb():
  	with app.app_context():
  
  		"""Removes all content from database and creates new tables"""
  		cleardb()
  		createdb()
  
  
  @manager.command
  def initdb():
  	with app.app_context():
  
  		"""Removes all content from database and initializes it
  		with default values
  		"""
  		resetdb()
  		init_db(site)
  		print 'Database initialized'
  
  
  @manager.command
  def popdb():
  	with app.app_context():
  
  		"""Removes all content from database and populates it
  		with sample data
  		"""
  		initdb()
  		pop_db(site)
  		print 'Database populated'
  
  if __name__ == '__main__':
  	manager.run()
  
new_contents: #!/usr/bin/env python
  from app.hermes.models import init_db, pop_db
  from os.path import abspath
  from flask import current_app as app
  from app import create_app, db
  from flask.ext.script import Manager
  
  manager = Manager(create_app)
  manager.add_option('-m', '--cfgmode', dest='config_mode',
  	default='Development')
  manager.add_option('-f', '--cfgfile', dest='config_file', type=abspath)
  site = 'http://127.0.0.1:5000/api'
  
  
  def get_site():
  	with app.app_context():
  		host = app.config['HOST']
  		port = app.config['PORT']
  # 		return 'http://%s:%s/api' % (host, port)
  		return 'http://127.0.0.1:5000/api'
  
  
  @manager.command
  def createdb():
  	with app.app_context():
  
  		"""Creates database if it doesn't already exist"""
  		db.create_all()
  		print 'Database created'
  
  
  @manager.command
  def cleardb():
  	with app.app_context():
  
  		"""Removes all content from database"""
  		db.drop_all()
  		print 'Database cleared'
  
  
  @manager.command
  def resetdb():
  	with app.app_context():
  
  		"""Removes all content from database and creates new tables"""
  		cleardb()
  		createdb()
  
  
  @manager.command
  def initdb():
  	with app.app_context():
  
  		"""Removes all content from database and initializes it
  		with default values
  		"""
  		resetdb()
  		init_db(site)
  		print 'Database initialized'
  
  
  @manager.command
  def popdb():
  	with app.app_context():
  
  		"""Removes all content from database and populates it
  		with sample data
  		"""
  		initdb()
  		pop_db(site)
  		print 'Database populated'
  
  if __name__ == '__main__':
  	manager.run()
  
subject: Add method to get site url