Example #1
0
import model

app = Flask(__name__)
app.debug = True
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///blog.db"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
app.config["SECRET_KEY"] = "notasecret"
app.config["SECURITY_REGISTERABLE"] = True
app.config["SECURITY_PASSWORD_HASH"] = "bcrypt"
app.config["SECURITY_PASSWORD_SALT"] = "mysalt"  # "hash_123678*",
app.config["SECURITY_SEND_REGISTER_EMAIL"] = False

app.config["APP_ROOT"] = os.path.dirname(os.path.abspath(__file__))
app.config["APP_STATIC"] = os.path.join(app.config["APP_ROOT"], "static")
app.config["MEDIA_ROOT"] = os.path.join(app.config["APP_STATIC"], "media")
app.config["MEDIA_URL"] = "/static/media/"

try:
    os.makedirs(app.config["MEDIA_ROOT"])
except OSError:
    pass

with app.app_context():
    db.init_app(app)
    db.app = app

    shlf = Shelf(app)
    shlf.init_db(db)
    shlf.init_admin()
    shlf.init_security(User, Role)
    shlf.load_plugins(("shelf.plugins.wysiwyg", "shelf.plugins.workflow", "shelf.plugins.library"))
Example #2
0
from flask import Flask
from flask.ext.thumbnails import Thumbnail
from flask_bootstrap import Bootstrap
from werkzeug.routing import BaseConverter

app = Flask(__name__)


class RegexConverter(BaseConverter):
    def __init__(self, url_map, *items):
        super(RegexConverter, self).__init__(url_map)
        self.regex = items[0]


app.url_map.converters["regex"] = RegexConverter

app.config.from_pyfile("settings.cfg")
app.config["MEDIA_FOLDER"] = "/Users/blee/workspace/blee/jag/media"
app.config["MEDIA_URL"] = "/media/"

thumb = Thumbnail(app)
Bootstrap(app)

from app import views