bottle flash2
1.0.0
병용 플래시 플러그인.
(Bottle-Flash2는 병 플래시의 포크입니다)
PIP를 사용하여 bottle-flash2 설치할 수 있습니다.
pip install bottle-flash2
환경에서 "병-플래시"를 실행하고 싶습니다.
Python 3.5.1
Bottle v0.12.9
이 프로젝트가 유지되지 않은 것 같습니다.
그래서 나는 그것을 포기했다.
간단한 예제 디렉토리를 참조하십시오.
SimpleTemplate 엔진이있는 병-플래시 2의 예는 여기에서 찾을 수 있습니다.
그리고
from bottle import Bottle , post , jinja2_template as template
from bottle_flash2 import FlashPlugin
# Flash Setup
app = Bottle ()
COOKIE_SECRET = 'super_secret_string'
app . install ( FlashPlugin ( secret = [ COOKIE_SECRET ]))
@ post ( '/flash_sample_done' )
def flash_sample ():
app . flash ( "flash message is here" )
# flash mesage is stored in list
# Therefore, it is possible to store a multiple messages.
app . flash ( "flash message 1" )
app . flash ( "flash message 2" )
return template ( 'index.html' , app = app ) {% set messages = app.get_flashed_messages() %}
{% if messages %}
< div id =" flash_messages " >
< ul >
{% for m in messages %}
< li > {{ m[0] }} </ li >
{% endfor %}
</ ul >
</ div >
{% endif %} version 0.12.9 or above later.
Latest Version -> '0.13-dev'
MIT