machristie commented on code in PR #167:
URL: 
https://github.com/apache/airavata-custos-portal/pull/167#discussion_r1102129049


##########
airavata_custos_portal/settings.py:
##########
@@ -27,7 +28,7 @@
 )
 
 # SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = True #os.environ.get("DJANGO_DEBUG", "true") == "true"
+DEBUG = os.environ.get("DJANGO_DEBUG", "true") == "true"

Review Comment:
   We might as well read this from .env as well



##########
airavata_custos_portal/apps/api/views.py:
##########
@@ -1,25 +1,14 @@
-from django.conf import settings
 from django.http import HttpResponse
 from rest_framework.decorators import api_view
 from rest_framework.response import Response
 
-from django.shortcuts import redirect, render
+from django.shortcuts import redirect
 import requests
 import base64
 import jwt
 
-import os
-import environ
-
-env = environ.Env()
-BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-environ.Env.read_env('.env')
-
-CUSTOS_CLIENT_ID = env("CUSTOS_CLIENT_ID")
-CUSTOS_CLIENT_SEC = env("CUSTOS_CLIENT_SEC")
-CUSTOS_API_URL = env("CUSTOS_API_URL")
-CUSTOS_SUPER_CLIENT_ID = env("CUSTOS_SUPER_CLIENT_ID")
-UNDER_MAINTENANCE = env("UNDER_MAINTENANCE")
+from airavata_custos_portal.settings import CUSTOS_CLIENT_ID, 
CUSTOS_CLIENT_SEC, CUSTOS_API_URL, CUSTOS_SUPER_CLIENT_ID, \

Review Comment:
   As I understand it, this is bad practice, see 
https://docs.djangoproject.com/en/dev/topics/settings/#using-settings-in-python-code
   
   You should just `from django.conf import settings` and then use 
`settings.CUSTOS_CLIENT_ID` etc.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to