一覧へ戻る
dag/flask-zodb(新しいタブで開きます)
主要言語: Python
Use the ZODB with Flask
- star 数
- 42
- watcher 数
- 5
- fork 数
- 8
- issue 数
- 3
- 最終更新
- 2011/10/13
主要言語: Python
Use the ZODB with Flask
Simple extension for integrating the ZODB in Flask applications.
app = Flask(__name__) db = ZODB(app) @app.before_request def set_db_defaults(): if 'entries' not in db: db['entries'] = List() @app.route('/') def show_entries(): return render_template('show_entries.html', entries=db['entries']) @app.route('/add', methods=['POST']) def add_entry(): db['entries'].append(request.form) flash('New entry was successfully posted') return redirect(url_for('show_entries'))
For more information see the documentation.