[Flask] setting SERVER_NAME for only CLI commands

Corey Boyle coreybrett at gmail.com
Thu Oct 28 16:18:47 EDT 2021

I would like to use url_for with the _external option for generating
some links inside emails that a CLI command will generate.

If I set the SERVER_NAME config var, it solves this problem nicely,
however, it breaks my local dev environment.

How would I set the SERVER_NAME only for CLI commands?

More information about the Flask mailing list