示例#1
0
文件: manager.py 项目: nezaj/mongoose
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'
示例#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()
示例#3
0
文件: manager.py 项目: nezaj/mongoose
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'
示例#4
0
def create_tables():
    db.create_all()