Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Adding environment port variable #2748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 27, 2020
Merged

Adding environment port variable #2748

merged 2 commits into from
Jan 27, 2020

Conversation

dinagraves
Copy link
Contributor

To run locally, the PORT environment variable needs to be set.

@dinagraves dinagraves requested review from averikitsch and a team as code owners January 23, 2020 23:31
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 23, 2020
@averikitsch
Copy link
Contributor

Does this mean we should remove the if os.getenv("PORT") else 8080 from the main.py?

@dinagraves
Copy link
Contributor Author

dinagraves commented Jan 24, 2020

Does this mean we should remove the if os.getenv("PORT") else 8080 from the main.py?

No, this is only for if you want to run the docker image locally. Without the PORT variable set, the container won't start! This is because of the line in the Dockerfiles: CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 main:app

You can still run the python file outside of a docker image, in which case, you need the getenv, eg: python main.py

@leahecole
Copy link
Collaborator

Once this passes the appropriate CI, I'll merge it in! I know that this uses f strings and we previously said that was okay for it to fail earlier python versions. :)

@leahecole leahecole merged commit a2e4e81 into master Jan 27, 2020
@leahecole leahecole deleted the cloud-run-local branch January 27, 2020 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.