chg: dev: per_page check

This commit is contained in:
rachmadaniHaryono 2018-05-02 20:31:45 +08:00
parent 93442a1e5f
commit 0a0a98479a

View File

@ -518,8 +518,9 @@ def view_statistic():
def create_app(config_filename=None): def create_app(config_filename=None):
"""create app.""" """create app."""
app = Flask(__name__) app = Flask(__name__)
app.config['BUKUSERVER_PER_PAGE'] = os.getenv( per_page = int(os.getenv('BUKUSERVER_PER_PAGE', DEFAULT_PER_PAGE))
'BUKUSERVER_PER_PAGE', DEFAULT_PER_PAGE) per_page = per_page if per_page > 0 else DEFAULT_PER_PAGE
app.config['BUKUSERVER_PER_PAGE'] = per_page
app.config['SECRET_KEY'] = os.getenv('BUKUSERVER_SERVER_SECRET_KEY') or os.urandom(24) app.config['SECRET_KEY'] = os.getenv('BUKUSERVER_SERVER_SECRET_KEY') or os.urandom(24)
bukudb = BukuDb() bukudb = BukuDb()
app.app_context().push() app.app_context().push()