Example #1
0
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URL"] = "sqlite:////tmp/test.db"
db = SQLAlchemy(app)
migrate = Migrate(app, db)

manager = Manager(app)
manager.add_command("db", MigrateCommand)

from my_app.catalog.views import catalog

app.register_blueprint(catalog)

db.create_all()

"""
def create_app():
    app = Flask(__name__)
    db.init_app(app)
    return app
"""
Example #2
0
__author__ = "Rudy"

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy

app = Flask("pyeve")

app.config["SQLALCHEMY_DATABASE_URL"] = "mysql+pymysql://root:cycki@192.168.1.3/eve"
app.config["SQLALCHEMY_ECHO"] = True
db = SQLAlchemy(app)


@app.route("/")
def index():
    return "HOWDY !!!"


if __name__ == "__main__":
    app.run()