Skip to content

Commit 6fdf426

Browse files
committed
PY secret fix
1 parent ef6d08d commit 6fdf426

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.env.sample

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ FLASK_DEBUG=True
22
DBNAME=<database name>
33
DBHOST=<database-hostname>
44
DBUSER=<db-user-name>
5-
DBPASS=<db-password>
5+
DBPASS=<db-password>
6+
SECRET_KEY=<secret key>

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,18 @@ Steps for running the server:
3939

4040
3. Create an `.env` file using `.env.sample` as a guide. Set the value of `DBNAME` to the name of an existing database in your local PostgreSQL instance. Set the values of `DBHOST`, `DBUSER`, and `DBPASS` as appropriate for your local PostgreSQL instance. If you're in the devcontainer, copy the values from `.env.sample.devcontainer`.
4141

42-
4. Run the migrations:
42+
4. In the `.env` file, fill in a secret value for `SECRET_KEY`. You can use this command to generate an appropriate value:
43+
44+
```shell
45+
python -c 'import secrets; print(secrets.token_hex())'
46+
47+
5. Run the migrations:
4348
4449
```shell
4550
python3 -m flask db upgrade
4651
```
4752
48-
5. Run the local server: (or use VS Code "Run" button and select "Run server")
53+
6. Run the local server: (or use VS Code "Run" button and select "Run server")
4954
5055
```shell
5156
python3 -m flask run

azureproject/production.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22

33
# SECURITY WARNING: keep the secret key used in production secret!
4-
SECRET_KEY = os.getenv('SECRET_KEY', 'flask-insecure-7ppocbnx@w71dcuinn*t^_mzal(t@o01v3fee27g%rg18fc5d@')
4+
SECRET_KEY = os.getenv('SECRET_KEY')
55

66
ALLOWED_HOSTS = [os.environ['WEBSITE_HOSTNAME']] if 'WEBSITE_HOSTNAME' in os.environ else []
77
CSRF_TRUSTED_ORIGINS = ['https://' + os.environ['WEBSITE_HOSTNAME']] if 'WEBSITE_HOSTNAME' in os.environ else []

0 commit comments

Comments
 (0)