Skip to content

Commit

Permalink
Merge pull request #203 from zstenger93/api_connections
Browse files Browse the repository at this point in the history
settings.py hardcoded debug check to confirm the problem
  • Loading branch information
zstenger93 authored Jan 6, 2024
2 parents 1299071 + dbd957e commit a6b5918
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
40 changes: 21 additions & 19 deletions backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
ALLOWED_HOSTS = ['localhost', '127.0.0.1', '0.0.0.0', '10.13.7.5', 'transcendence-backend-znhl.onrender.com']

# Authentication settings
if DEBUG:
REDIRECT_URI = "http://localhost:8000"
else:
REDIRECT_URI = "https://transcendence-backend-znhl.onrender.com"
# if DEBUG:
# REDIRECT_URI = "http://localhost:8000"
# else:
REDIRECT_URI = "https://transcendence-backend-znhl.onrender.com"

print("DEBUG:", DEBUG)

# Application definition

Expand Down Expand Up @@ -110,21 +112,21 @@
# }

# THIS IS THE DATABASE CONFIGURATION FOR THE DOCKER CONTAINER
if DEBUG:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'transcend_users_db',
'USER': 'transcend_user',
'PASSWORD': 'transcend_pwd',
'HOST': 'db',
'PORT': '5432',
}
}
else:
DATABASES = {
'default': dj_database_url.parse(os.getenv('DATABASE_URL'))
}
# if DEBUG:
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': 'transcend_users_db',
# 'USER': 'transcend_user',
# 'PASSWORD': 'transcend_pwd',
# 'HOST': 'db',
# 'PORT': '5432',
# }
# }
# else:
DATABASES = {
'default': dj_database_url.parse(os.getenv('DATABASE_URL'))
}

# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
Expand Down
26 changes: 14 additions & 12 deletions backend/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@


def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
for key, value in os.environ.items():
print(f"{key}: {value}")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()
main()

0 comments on commit a6b5918

Please sign in to comment.