Ejemplo n.º 1
0
def recreate():
    "Recreates database tables (same as issuing 'drop' and then 'create')"
    print 'Connected to {}'.format(repr(db.engine.url))
    if prompt_bool("Are you sure you want to recreate the database?"):
        db.drop_all()
        db.create_all()
        print 'Database re-created'
Ejemplo n.º 2
0
from flask import Flask
from api.api import api_route
from data.db import db
from web.web import web_route


def register_extensions(app):
    db.init_app(app)


def create_app():
    app = Flask(__name__)
    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://geo.db'
    app.register_blueprint(api_route, url_prefix='/api')
    app.register_blueprint(web_route)
    register_extensions(app)
    return app


app = create_app()

db.create_all()
Ejemplo n.º 3
0
def create():
    "Creates database tables from sqlalchemy models"
    print 'Connected to {}'.format(repr(db.engine.url))
    if prompt_bool("Are you sure you want to create the tables?"):
        db.create_all()
        print 'Tables created'
Ejemplo n.º 4
0
def create_tables():
    db.create_all()