vnoelifant / charity-finder

3 stars 0 forks source link

I would set all OS environment variables in settings.py #4

Closed bbelderbos closed 1 year ago

bbelderbos commented 1 year ago

So I would move this to settings: https://github.com/vnoelifant/charity-finder/blob/main/charity_finder/charity_api.py#L13

You also want these set in env:

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-n%+zxdi&o0j5wt^5v5@(!s#rggckotik+8vw=5orzwd1$_2wti'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

And you can set them in an .env file so you don't have to rely on your os.environ (eg set it manually every time you go back to the project). The .env file should be gitignored to not expose the API key. I would commit an empty .env-template file so other devs of the project know what to set.

See also: https://pybit.es/articles/how-to-handle-environment-variables-in-python/

vnoelifant commented 1 year ago

I think this is closed with the merge