Example #1
0
from flask.ext.misaka import Misaka
import os
from basedir import basedir
import flask_admin as admin
from flask.ext.admin import Admin, BaseView, expose
from flask.ext.admin.contrib.sqla import ModelView


# 实例创建+蓝图注册
app = Flask(__name__)
# 配置(通用)
app.config["SECRET_KEY"] = "I hate flask!"
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(basedir, "muxi_data.sqlite")  # 系统相应替换
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True
app.config["WHOOSH_BASE"] = "search.db"
app.config["MAX_SEARCH_RESULTS"] = 5  # 图书搜索最多加载5个搜索结果
# app.config['UPLOAD_FOLDER'] = '/Users/apple/www/bitbucket/muxi_site/muxiwebsite/book/static/image/'
app.config["MUXI_ADMIN"] = "neo1218"
app.config["SHARE_PER_PAGE"] = 5
app.config["SHARE_HOT_PER_PAGE"] = 3


# 初始化扩展(app全局属性)
db = SQLAlchemy(app)
login_manager = LoginManager(app)
login_manager.session_protection = "strong"
login_manager.login_view = "auth.login"
pagedown = PageDown(app)
misaka = Misaka(app)

Example #2
0
# coding: utf-8
"""
    muxibook 木犀图书管理系统
    ~~~~~~~~~~~~~~~~~~~~~~~~~

        实现图书借阅管理功能
"""
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager


app = Flask(__name__)
app.config["SECRET_KEY"] = "I hate flask!"
# app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///path/to/data.sqlite"  # 系统相应替换
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////path/to/data.sqlite"  # 系统相应替换
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True
app.config["WHOOSH_BASE"] = "search.db"
app.config["MAX_SEARCH_RESULTS"] = 5  # 最大加载5个搜索结果
app.config["UPLOAD_FOLDER"] = "/Users/apple/www/project/MuxiBookManagement/app/static/image/"


db = SQLAlchemy(app)
login_manager = LoginManager(app)
login_manager.session_protection = "strong"
login_manager.login_view = "login"


from . import models, views, forms