Don't read .env from within Python

Docker already puts the contents of .env in the environment.
This commit is contained in:
Bart Schuurmans 2024-03-11 14:51:37 +01:00
parent 304c47863b
commit 072bd3ffe5
3 changed files with 1 additions and 7 deletions

View file

@ -1,4 +1,5 @@
""" bookwyrm settings and configuration """
import os
from typing import AnyStr
@ -13,7 +14,6 @@ from django.core.exceptions import ImproperlyConfigured
# pylint: disable=line-too-long
env = Env()
env.read_env()
DOMAIN = env("DOMAIN")
with open("VERSION", encoding="utf-8") as f:

View file

@ -8,11 +8,8 @@ https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from environs import Env
from django.core.wsgi import get_wsgi_application
Env.read_env()
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bookwyrm.settings")
application = get_wsgi_application()

View file

@ -2,10 +2,7 @@
import os
import sys
from environs import Env
if __name__ == "__main__":
Env.read_env() # load environment variables from .env
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bookwyrm.settings")
try:
from django.core.management import execute_from_command_line