热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

Flask 面试题与答案

Test your skills through the online practice test: Flask Quiz Online Practice Test

问题 21. How to create the RESTFul application in the Flask framework?

There are so many extensions that we can use to create the RESTFul application in Flask. We need to choose them depending upon the requirements.

A few of them are as follows:

  1. Flask-RESTFul.
  2. Flask-API.
  3. Flask-RESTX.
  4. Connexion.

这有帮助吗? 添加评论 查看评论
 

问题 22. How can we get a user agent in Flask?

We can use the request object, see the given below code:

From flask import Flask
From flask import request
app=Flask(_name_)
@app.route(“/”)
Def index():
val=request.args.get(“var”)
user_agent=request.headers.get(‘User-Agent’)
response = """
<p>

Hello, World! {}
<br/>
You are accessing this app with {}
</p>""".format(val, user_agent)
return response

Hello, World!{}

you are accessing this app with {}

if_name_==”_main_”;
app.run(host=”0.0.0.0”,port=8080)

这有帮助吗? 添加评论 查看评论
 

问题 23. How to use URLs in Flask?

We need to call the view function with parameters and give them values to generate URLs. Mainly Flask url_for the function we use here. It can also be used in Flask templates.

这有帮助吗? 添加评论 查看评论
 

问题 24. How to create an admin interface in Flask?

Here we also need to use one of the Flask extensions named Flask-Admin. It helps to group all individual views together in classes. Another extension named Flask-Appbuilder can be used. It has a built-in admin interface.

这有帮助吗? 添加评论 查看评论
 

问题 25. Explain the process of using the session in Flask?

The session is mainly used to store data in requests. We can store and get data from the session object in Flask. As shown below code we can try to do this:

From flask import Flask
sessionapp=Flask(_name_)
@app.route(‘/use_session’)
Def use_session():
If ’song’ not in session;
session[;songs’]={‘title’;’Tapestry’,’Bruno Major’}
return session.get(‘songs’)

@app.route(‘/delete_session’)
def delete_session():
session.pop(‘song’,None)
return “removed song from session”

这有帮助吗? 添加评论 查看评论
 

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。