beneon's recent timeline updates
beneon

beneon

🏢  佛山四面体科技有限公司
V2EX member #188279, joined on 2016-08-22 20:44:18 +08:00
beneon's recent replies
Dec 8, 2020
Replied to a topic by ushio Evernote 印象笔记双十二吃相更进一步难看
今天服务器死机直到现在都没反应,我要把网断了才能离线打开原来的笔记
然后最搞笑的是这货服务器 down 了以后去后台想找个人工客服来骂两句都没法连上去,真的太棒棒了
Dec 8, 2020
Replied to a topic by beneon 宽带症候群 tempest is gone
@jousca 大佬指条学习路径呗,这块我完全是空白,之前用 bwg 快乐过一段日子,但是现在那种简单的技术已经没法用了
http://flask.pocoo.org/docs/0.12/patterns/appfactories/
flask 文档关于工厂模式里面提到了上面的这种套路。

It ’ s preferable to create your extensions and app factories so that the extension object does not initially get bound to the application.

Using Flask-SQLAlchemy, as an example, you should not do something along those lines:

def create_app(config_filename):
app = Flask(__name__)
app.config.from_pyfile(config_filename)

db = SQLAlchemy(app)

But, rather, in model.py (or equivalent):

db = SQLAlchemy()

and in your application.py (or equivalent):

def create_app(config_filename):
app = Flask(__name__)
app.config.from_pyfile(config_filename)

from yourapplication.model import db
db.init_app(app)
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4051 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 10:22 · PVG 18:22 · LAX 03:22 · JFK 06:22
♥ Do have faith in what you're doing.