Skip to content

Commit

Permalink
1621 corrected the settings file
Browse files Browse the repository at this point in the history
  • Loading branch information
raftmsohani committed Jul 11, 2024
1 parent cc9997d commit cab98c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions tdrs-backend/tdpservice/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ class Common(Configuration):
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static")
]
STATICFILES_DIRS = []
STATIC_URL = "/static/"
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
Expand Down Expand Up @@ -164,7 +162,7 @@ class Common(Configuration):
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": STATICFILES_DIRS,
"DIRS": [os.path.join(BASE_DIR, "static")],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down
11 changes: 5 additions & 6 deletions tdrs-backend/tdpservice/users/api/login_redirect_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,15 @@ def get_ams_configuration():
Includes currently published URLs for authorization, token, etc.
"""
return None
r = requests.get(settings.AMS_CONFIGURATION_ENDPOINT)
r = requests.get(settings.AMS_CONFIGURATION_ENDPOINT, timeout=10)
if r.status_code != 200:
logger.error(
f"Failed to get AMS configuration: {r.status_code} - {r.text}"
)
return None
return None, f"Failed to get AMS configuration: {r.status_code} - {r.text}"
else:
data = r.json()
return data
return data, None

def get(self, request, *args, **kwargs):
"""Handle login workflow based on request origin."""
Expand All @@ -112,8 +111,8 @@ def get(self, request, *args, **kwargs):
nonce = secrets.token_hex(32)
"""Get request and manage login information with AMS OpenID."""
configuration = self.get_ams_configuration()
if not configuration:
rendered = render_to_string('error_pages/500.html', {'foo': 'bar'})
if not configuration[0]:
rendered = render_to_string('error_pages/500.html', {'error': configuration[1]})
return HttpResponse(rendered,
status=200)
auth_params = {
Expand Down

0 comments on commit cab98c5

Please sign in to comment.