且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在瓶资源中测试会话

更新时间:2023-11-24 22:10:52

If you did not set a custom app.session_interface, then you forgot to set a secret key:

def setUp(self):
    app.config['SECRET_KEY'] = 'sekrit!'
    self.app = app.app.test_client()

This just sets a mock secret key for the tests, but for your application to work you'll need to generate a production secret key, see the sessions section in the Quickstart documentation for tips on how to produce a good secret key.

Without a secret key, the default session implementation fails to create a session.