File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ method::
38
38
39
39
app.config.update(
40
40
TESTING=True,
41
- SECRET_KEY=b'_5#y2L"F4Q8z\n\xec]/ '
41
+ SECRET_KEY='192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf '
42
42
)
43
43
44
44
@@ -180,8 +180,8 @@ The following configuration values are used internally by Flask:
180
180
application. It should be a long random ``bytes `` or ``str ``. For
181
181
example, copy the output of this to your config::
182
182
183
- $ python -c 'import os ; print(os.urandom(16 ))'
184
- b'_5#y2L"F4Q8z\n\xec]/ '
183
+ $ python -c 'import secrets ; print(secrets.token_hex() ))'
184
+ '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf '
185
185
186
186
**Do not reveal the secret key when posting questions or committing code. **
187
187
@@ -468,7 +468,7 @@ sure to use uppercase letters for your config keys.
468
468
Here is an example of a configuration file::
469
469
470
470
# Example configuration
471
- SECRET_KEY = b'_5#y2L"F4Q8z\n\xec]/ '
471
+ SECRET_KEY = '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf '
472
472
473
473
Make sure to load the configuration very early on, so that extensions have
474
474
the ability to access the configuration when starting up. There are other
Original file line number Diff line number Diff line change @@ -847,8 +847,8 @@ sessions work::
847
847
generator. Use the following command to quickly generate a value for
848
848
:attr: `Flask.secret_key ` (or :data: `SECRET_KEY `)::
849
849
850
- $ python -c 'import os ; print(os.urandom(16 ))'
851
- b'_5#y2L"F4Q8z\n\xec]/ '
850
+ $ python -c 'import secrets ; print(secrets.token_hex( ))'
851
+ '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf '
852
852
853
853
A note on cookie-based sessions: Flask will take the values you put into the
854
854
session object and serialize them into a cookie. If you are finding some
Original file line number Diff line number Diff line change @@ -88,17 +88,17 @@ You can use the following command to output a random secret key:
88
88
89
89
.. code-block :: none
90
90
91
- $ python -c 'import os ; print(os.urandom(16 ))'
91
+ $ python -c 'import secrets ; print(secrets.token_hex( ))'
92
92
93
- b'_5#y2L"F4Q8z\n\xec]/ '
93
+ '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf '
94
94
95
95
Create the ``config.py `` file in the instance folder, which the factory
96
96
will read from if it exists. Copy the generated value into it.
97
97
98
98
.. code-block :: python
99
99
:caption: `` venv/ var/ flaskr- instance/ config.py``
100
100
101
- SECRET_KEY = b ' _5#y2L"F4Q8z \n\xec ]/ '
101
+ SECRET_KEY = ' 192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf '
102
102
103
103
You can also set any other necessary configuration here, although
104
104
``SECRET_KEY `` is the only one needed for Flaskr.
You can’t perform that action at this time.
0 commit comments