Skip to content
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

Issue 241 #244

Merged
merged 7 commits into from
Nov 23, 2022
Merged

Issue 241 #244

merged 7 commits into from
Nov 23, 2022

Conversation

rsk2
Copy link

@rsk2 rsk2 commented Nov 19, 2022

Description of Changes

Notes for Deployment

Screenshots (if appropriate)

Tests and linting

  • I have rebased my changes on main

  • just lint passes

  • just test passes

@@ -21,7 +21,7 @@ def send_email(to, subject, template, **kwargs):
msg.body = render_template(template + ".txt", **kwargs)
msg.html = render_template(template + ".html", **kwargs)
# Only send email if we're in prod or staging, otherwise log it so devs can see it
if app.env in ("staging", "production"):
if app.debug in ("staging", "production"):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sea-kelp, I have changed app.env to app.debug. Is this fine?

Copy link
Collaborator

@sea-kelp sea-kelp Nov 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually want to use app.config["ENVIRONMENT"] instead of app.debug to check the value of the new variable you've added!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense

Copy link
Collaborator

@sea-kelp sea-kelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! There is just one other place where FLASK_ENV is used

FLASK_ENV=development # for prod: production

@@ -21,7 +21,7 @@ def send_email(to, subject, template, **kwargs):
msg.body = render_template(template + ".txt", **kwargs)
msg.html = render_template(template + ".html", **kwargs)
# Only send email if we're in prod or staging, otherwise log it so devs can see it
if app.env in ("staging", "production"):
if app.debug in ("staging", "production"):
Copy link
Collaborator

@sea-kelp sea-kelp Nov 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually want to use app.config["ENVIRONMENT"] instead of app.debug to check the value of the new variable you've added!

@sea-kelp sea-kelp linked an issue Nov 20, 2022 that may be closed by this pull request
@sea-kelp
Copy link
Collaborator

Hi @rsk2, looks like there's one more place where you need to make a change:

This section:

class BaseConfig(object):
# DB SETUP

should be changed to:

class BaseConfig(object):
    ENVIRONMENT = os.environ.get("ENVIRONMENT", "")
    # DB SETUP

@sea-kelp
Copy link
Collaborator

So close! The tests are failing because these two lines should have app.config["ENV"] changed to app.config["ENVIRONMENT"]

if current_app.config["ENV"] == "testing" or prompt_yes_no(

if force_create and current_app.config["ENV"] == "production":

@rsk2
Copy link
Author

rsk2 commented Nov 23, 2022

@sea-kelp , I have made the changes in OpenOversight/OpenOversight/app/commands.py

Additionally, I ran just test on my local and test_commands passes. However, a different test has failed; please see the screenshot below:

image

@sea-kelp
Copy link
Collaborator

@sea-kelp , I have made the changes in OpenOversight/OpenOversight/app/commands.py

Additionally, I ran just test on my local and test_commands passes. However, a different test has failed; please see the screenshot below:

image

It looks like the test run passed on here so I think it might just be a transient Selenium error?

Really appreciate your help with fixing this issue! :)

@sea-kelp sea-kelp marked this pull request as ready for review November 23, 2022 17:41
@sea-kelp sea-kelp requested a review from a team as a code owner November 23, 2022 17:41
@sea-kelp sea-kelp merged commit ca6dfa8 into OrcaCollective:main Nov 23, 2022
@AetherUnbound
Copy link
Collaborator

Thank you for the contribution @rsk2!

@AetherUnbound
Copy link
Collaborator

I've updated our .env file in production so this won't cause any hiccups on our next release 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace usages of FLASK_ENV
3 participants