Skip to content

Commit

Permalink
use django template
Browse files Browse the repository at this point in the history
  • Loading branch information
raftmsohani committed Jul 11, 2024
1 parent dfd0161 commit cc9997d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tdrs-backend/tdpservice/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ 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 = []
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static")
]
STATIC_URL = "/static/"
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
Expand Down
6 changes: 5 additions & 1 deletion tdrs-backend/tdpservice/users/api/login_redirect_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.conf import settings
from django.http import HttpResponseRedirect, HttpResponse
from django.views.generic.base import RedirectView
from django.template.loader import render_to_string

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -93,6 +94,7 @@ def get_ams_configuration():
Includes currently published URLs for authorization, token, etc.
"""
return None
r = requests.get(settings.AMS_CONFIGURATION_ENDPOINT)
if r.status_code != 200:
logger.error(
Expand All @@ -111,7 +113,9 @@ def get(self, request, *args, **kwargs):
"""Get request and manage login information with AMS OpenID."""
configuration = self.get_ams_configuration()
if not configuration:
return HttpResponse("Failed to get AMS configuration", status=500)
rendered = render_to_string('error_pages/500.html', {'foo': 'bar'})
return HttpResponse(rendered,
status=200)
auth_params = {
"client_id": settings.AMS_CLIENT_ID,
"nonce": nonce,
Expand Down
2 changes: 1 addition & 1 deletion tdrs-frontend/nginx/local/locations.conf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ location = / {
proxy_intercept_errors on;
error_page 500 502 504 /50x.html;
location = /50x.html {
sub_filter '##STATUS##' $resp_body;
sub_filter '##STATUS##' $status;
root /usr/share/nginx/html;
try_files /50x.html @error;
internal;
Expand Down

0 comments on commit cc9997d

Please sign in to comment.