def create_database():
    """ creates database if necessary """
    db = get_db()
    response = db.query('SHOW DATABASES')
    items = list(response.get_points('databases'))
    databases = [database['name'] for database in items]
    # if database does not exists, create it
    if settings.INFLUXDB_DATABASE not in databases:
        db.create_database(settings.INFLUXDB_DATABASE)
        print('Created inlfuxdb database {0}'.format(settings.INFLUXDB_DATABASE))
creates database if necessary