Skip to content

PORT environment variable missing #5

@timoles

Description

@timoles

Hey, I just followed this tutorial, and the PORT variable is missing from the .env file.

When setting up the .env file according to the tutorial:

cat .env

>CLIENT_ORIGIN_URL=http://localhost:4040
>AUTH0_AUDIENCE=https://xxx
>AUTH0_DOMAIN=xxx.eu.auth0.com

docker-compose up

The following error message is presented (notice the second to last line, Missing PORT environment variable):

Recreating api_flask_python_hello-world_api_1 ... done
Attaching to api_flask_python_hello-world_api_1
api_1  | Failed to read config file: /app/gunicorn.conf.py
api_1  | Traceback (most recent call last):
api_1  |   File "/app/common/utils/__init__.py", line 5, in safe_get_env_var
api_1  |     return environ[key]
api_1  |   File "/usr/lib/python3.9/os.py", line 679, in __getitem__
api_1  |     raise KeyError(key) from None
api_1  | KeyError: 'PORT'
api_1  |
api_1  | During handling of the above exception, another exception occurred:
api_1  |
api_1  | Traceback (most recent call last):
api_1  |   File "/packages/gunicorn/app/base.py", line 111, in get_config_from_filename
api_1  |     spec.loader.exec_module(mod)
api_1  |   File "<frozen importlib._bootstrap_external>", line 790, in exec_module
api_1  |   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
api_1  |   File "/app/gunicorn.conf.py", line 10, in <module>
api_1  |     bind = f"0.0.0.0:{safe_get_env_var('PORT')}"
api_1  |   File "/app/common/utils/__init__.py", line 7, in safe_get_env_var
api_1  |     raise NameError(f"Missing {key} environment variable.")
api_1  | NameError: Missing PORT environment variable.
api_flask_python_hello-world_api_1 exited with code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions