Skip to content

Commit 6a8f60f

Browse files
authored
chore: deprecate FLASK_ENV and improve conf.ENVIRONMENT_TAG_CONFIG (#24404)
1 parent 46159fd commit 6a8f60f

File tree

12 files changed

+52
-29
lines changed

12 files changed

+52
-29
lines changed

.flaskenv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# limitations under the License.
1616
#
1717
FLASK_APP="superset.app:create_app()"
18-
FLASK_ENV="development"
18+
FLASK_DEBUG=true

.github/workflows/superset-applitool-cypress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
browser: ["chrome"]
2929
node: [16]
3030
env:
31-
FLASK_ENV: development
31+
SUPERSET_ENV: development
3232
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
3333
SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:[email protected]:15432/superset
3434
PYTHONPATH: ${{ github.workspace }}

.github/workflows/superset-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
containers: [1, 2, 3]
2727
browser: ["chrome"]
2828
env:
29-
FLASK_ENV: development
29+
SUPERSET_ENV: development
3030
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
3131
SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:[email protected]:15432/superset
3232
PYTHONPATH: ${{ github.workspace }}

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ superset load-examples
453453
# Start the Flask dev web server from inside your virtualenv.
454454
# Note that your page may not have CSS at this point.
455455
# See instructions below how to build the front-end assets.
456-
FLASK_ENV=development superset run -p 8088 --with-threads --reload --debugger
456+
superset run -p 8088 --with-threads --reload --debugger --debug
457457
```
458458

459459
Or you can install via our Makefile
@@ -477,7 +477,7 @@ $ make pre-commit
477477
via `.flaskenv`, however if needed, it should be set to `superset.app:create_app()`**
478478

479479
If you have made changes to the FAB-managed templates, which are not built the same way as the newer, React-powered front-end assets, you need to start the app without the `--with-threads` argument like so:
480-
`FLASK_ENV=development superset run -p 8088 --reload --debugger`
480+
`superset run -p 8088 --reload --debugger --debug`
481481

482482
#### Dependencies
483483

@@ -518,7 +518,7 @@ def FLASK_APP_MUTATOR(app):
518518
Then make sure you run your WSGI server using the right worker type:
519519

520520
```bash
521-
FLASK_ENV=development gunicorn "superset.app:create_app()" -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -b 127.0.0.1:8088 --reload
521+
gunicorn "superset.app:create_app()" -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -b 127.0.0.1:8088 --reload
522522
```
523523

524524
You can log anything to the browser console, including objects:
@@ -603,7 +603,7 @@ So a typical development workflow is the following:
603603
1. [run Superset locally](#flask-server) using Flask, on port `8088` — but don't access it directly,<br/>
604604
```bash
605605
# Install Superset and dependencies, plus load your virtual environment first, as detailed above.
606-
FLASK_ENV=development superset run -p 8088 --with-threads --reload --debugger
606+
superset run -p 8088 --with-threads --reload --debugger --debug
607607
```
608608
2. in parallel, run the Webpack dev server locally on port `9000`,<br/>
609609
```bash
@@ -922,7 +922,7 @@ For debugging locally using VSCode, you can configure a launch configuration fil
922922
"module": "flask",
923923
"env": {
924924
"FLASK_APP": "superset",
925-
"FLASK_ENV": "development"
925+
"SUPERSET_ENV": "development"
926926
},
927927
"args": [
928928
"run",

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ FROM python:${PY_VER} AS lean
5252
WORKDIR /app
5353
ENV LANG=C.UTF-8 \
5454
LC_ALL=C.UTF-8 \
55-
FLASK_ENV=production \
55+
SUPERSET_ENV=production \
5656
FLASK_APP="superset.app:create_app()" \
5757
PYTHONPATH="/app/pythonpath" \
5858
SUPERSET_HOME="/app/superset_home" \

RELEASING/from_tarball_entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ superset init
4141
# Loading examples
4242
superset load-examples --force
4343

44-
FLASK_ENV=development FLASK_APP="superset.app:create_app()" \
44+
SUPERSET_ENV=development FLASK_APP="superset.app:create_app()" \
4545
flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0

UPDATING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ assists people when migrating to a new version.
3131
- [23652](https://github.com/apache/superset/pull/23652): Enables GENERIC_CHART_AXES feature flag by default.
3232
- [23226](https://github.com/apache/superset/pull/23226): Migrated endpoint `/estimate_query_cost/<int:database_id>` to `/api/v1/sqllab/estimate/`. Corresponding permissions are can estimate query cost on SQLLab. Make sure you add/replace the necessary permissions on any custom roles you may have.
3333
- [23890](https://github.com/apache/superset/pull/23890): Removes Python 3.8 support.
34+
- [24404](https://github.com/apache/superset/pull/24404): FLASK_ENV is getting
35+
deprecated, we recommend using SUPERSET_ENV and reviewing your
36+
config for ENVIRONMENT_TAG_CONFIG, which enables adding a tag in the navbar to
37+
make it more clear which envrionment your are in.
38+
`SUPERSET_ENV=production` and `SUPERSET_ENV=development` are the two
39+
supported switches based on the default config.
3440

3541
### Breaking Changes
3642

docker/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PYTHONPATH=/app/pythonpath:/app/docker/pythonpath_dev
3939
REDIS_HOST=redis
4040
REDIS_PORT=6379
4141

42-
FLASK_ENV=development
42+
SUPERSET_ENV=development
4343
SUPERSET_ENV=development
4444
SUPERSET_LOAD_EXAMPLES=yes
4545
CYPRESS_CONFIG=false

docker/.env-non-dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PYTHONPATH=/app/pythonpath:/app/docker/pythonpath_dev
3939
REDIS_HOST=redis
4040
REDIS_PORT=6379
4141

42-
FLASK_ENV=production
42+
SUPERSET_ENV=production
4343
SUPERSET_ENV=production
4444
SUPERSET_LOAD_EXAMPLES=yes
4545
SUPERSET_SECRET_KEY=TEST_NON_DEV_SECRET

docs/docs/contributing/local-backend.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ superset load-examples
4242

4343
# Start the Flask dev web server from inside your virtualenv.
4444
# Note that your page may not have CSS at this point.
45-
FLASK_ENV=development superset run -p 8088 --with-threads --reload --debugger
45+
superset run -p 8088 --with-threads --reload --debugger --debug
4646
```
4747

4848
Or you can install via our Makefile
@@ -66,7 +66,7 @@ make pre-commit
6666
via `.flaskenv`, however if needed, it should be set to `superset.app:create_app()`**
6767

6868
If you have made changes to the FAB-managed templates, which are not built the same way as the newer, React-powered front-end assets, you need to start the app without the `--with-threads` argument like so:
69-
`FLASK_ENV=development superset run -p 8088 --reload --debugger`
69+
`superset run -p 8088 --reload --debugger --debug`
7070

7171
#### Dependencies
7272

@@ -93,7 +93,7 @@ def FLASK_APP_MUTATOR(app):
9393
Then make sure you run your WSGI server using the right worker type:
9494

9595
```bash
96-
FLASK_ENV=development gunicorn "superset.app:create_app()" -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -b 127.0.0.1:8088 --reload
96+
SUPERSET_ENV=development gunicorn "superset.app:create_app()" -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -b 127.0.0.1:8088 --reload
9797
```
9898

9999
You can log anything to the browser console, including objects:

0 commit comments

Comments
 (0)