Flask Documentation (1.1.x)disabled. 1.4.7 Accessing Request Data For web applications it’s crucial to react to the data a client sends to the server. In Flask this information is provided by the global request object. If you have save('/var/www/uploads/uploaded_file.txt') ... If you want to know how the file was named on the client before it was uploaded to your application, you can access the filename attribute. However please that this value can be forged so never ever trust that value. If you want to use the filename of the client to store the file on the server, pass it through the secure_filename() function that Werkzeug provides0 码力 | 291 页 | 1.25 MB | 1 年前3
Flask Documentation (1.1.x)Object Blueprint Objects Incoming Request Data Response Objects Sessions Session Interface Test Client Test CLI Runner Application Globals Useful Functions and Classes Message Flashing JSON Support Template more information. Accessing Request Data For web applications it’s crucial to react to the data a client sends to the server. In Flask this information is provided by the global request object. If you have save('/var/www/uploads/uploaded_file.txt') ... If you want to know how the file was named on the client before it was uploaded to your application, you can access the filename [https://werkzeug.palletsprojects0 码力 | 428 页 | 895.98 KB | 1 年前3
Flask入门教程方法一次添加多个模型类实例,传入列表 db.session.add_all([user, movie]) db.session.commit() self.client = app.test_client() # 创建测试客户端 self.runner = app.test_cli_runner() # 创建测试命令运行器 def tearDown(self): 序运行状态 不同,所以需要调用 db.session.remove() 来确保数据库会话被清除。 测试客户端 app.test_client() 返回一个测试客户端对象,可以用来模拟客户端(浏览 器),我们创建类属性 self.client 来保存它。对它调用 get() 方法就相当 于浏览器向服务器发送 GET 请求,调用 post() 则相当于浏览器向服务器发送 st.TestCase): # ... # 测试 404 页面 def test_404_page(self): response = self.client.get('/nothing') # 传入目标 URL data = response.get_data(as_text=True) self.assertIn('Page0 码力 | 127 页 | 7.62 MB | 1 年前3
Flask-RESTful Documentation Release 0.3.10time to process. However, often it is nice to have the errors bundled together and sent back to the client all at once. This behavior can be specified either at the Flask application level or on the specific0 码力 | 42 页 | 84.60 KB | 1 年前3
Flask-RESTful Documentation
Release 0.3.10time to process. However, often it is nice to have the errors bundled together and sent back to the client all at once. This behavior can be specified either at the Flask application level or on the specific0 码力 | 39 页 | 212.29 KB | 1 年前3
Flask-RESTful Documentation
Release 0.3.6time to process. However, often it is nice to have the errors bundled together and sent back to the client all at once. This behavior can be specified either at the Flask application level or on the specific0 码力 | 46 页 | 245.60 KB | 1 年前3
Flask-RESTful Documentation Release 0.3.6time to process. However, often it is nice to have the errors bundled together and sent back to the client all at once. This behavior can be specified either at the Flask application level or on the specific0 码力 | 49 页 | 91.90 KB | 1 年前3
Flask-RESTful Documentation
Release 0.3.7time to process. However, often it is nice to have the errors bundled together and sent back to the client all at once. This behavior can be specified either at the Flask application level or on the specific0 码力 | 50 页 | 253.09 KB | 1 年前3
Flask-RESTful Documentation
Release 0.3.8time to process. However, often it is nice to have the errors bundled together and sent back to the client all at once. This behavior can be specified either at the Flask application level or on the specific0 码力 | 50 页 | 253.64 KB | 1 年前3
Flask-RESTful Documentation Release 0.3.8time to process. However, often it is nice to have the errors bundled together and sent back to the client all at once. This behavior can be specified either at the Flask application level or on the specific0 码力 | 55 页 | 93.30 KB | 1 年前3
共 11 条
- 1
- 2













