""" Starts a development server. """ import photo_album app = photo_album.create_app('development-config.py') app.run()
import shutil import os from flask.ext.script import Manager, prompt_bool from sqlalchemy import schema from sqlalchemy.engine import reflection from photo_album import create_app, db from photo_album.user.models import User from photo_album.albums.models import Album from instance import initial_data config = input("Please enter the config you want to use: ") # TODO: Need a better way of dealing with this. app = create_app(config) manager = Manager(app) @manager.command def create_database(): """ Creates the tables in the database and adds any initial data from the instance/initial_data.py file to them. """ with app.app_context(): db.create_all() # Create the default accounts. for user in initial_data.users: create_user_account(db, name=user['name'], password=user['password'], is_admin=user['is_admin'])
""" Create the production app for serving through wsgi. Calling run() on the app in unnecessary. """ import photo_album app = photo_album.create_app('production-config.py')