INNER CODE UNIT · Python

total_page

kingname/SourceCodeofMongoRedis · chapter_12/QASystem/main.py:27

    total_page = total_question // 3 + (1 if total_question % 3 > 0 else 0)
    page_list = [x for x in range(total_page)]
    return render_template('index.html',
                           question_list=question_list,
                           session=session_data,
                           current_page=page,
                           page_list=page_list)


@app.route('/logout')
def logout():
    session_data = redis.fetch_session(request.cookies.get('session'))
    if not session_data:
        return json.dumps({'success': False, 'reason': '未登录!'})
    redis.delete_session(request.cookies.get('session'))
    return json.dumps({'success': True})

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…