Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit b614d0f

Browse files
committed
apped os path on json files
1 parent fef72ce commit b614d0f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

gsoc/models.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from gsoc.common.utils.tools import build_send_reminder_json
4242

4343
from gsoc.constants import *
44-
from gsoc.settings import PROPOSALS_PATH
44+
from gsoc.settings import BASE_DIR, PROPOSALS_PATH
4545
from settings_local import ADMINS
4646

4747
from google.auth.transport.requests import Request
@@ -59,16 +59,21 @@ def gen_uuid_str():
5959

6060
def getCreds():
6161
creds = None
62-
if os.path.exists('token.json'):
63-
creds = Credentials.from_authorized_user_file('token.json', SCOPES)
62+
if os.path.exists(os.path.join(BASE_DIR,'token.json')):
63+
creds = Credentials.from_authorized_user_file(
64+
os.path.join(BASE_DIR,'token.json'),
65+
SCOPES
66+
)
6467
if not creds or not creds.valid:
6568
if creds and creds.expired and creds.refresh_token:
6669
creds.refresh(Request())
6770
else:
6871
flow = InstalledAppFlow.from_client_secrets_file(
69-
'credentials.json', SCOPES)
72+
os.path.join(BASE_DIR,'credentials.json'),
73+
SCOPES
74+
)
7075
creds = flow.run_local_server(port=0)
71-
with open('token.json', 'w') as token:
76+
with open(os.path.join(BASE_DIR,'token.json'), 'w') as token:
7277
token.write(creds.to_json())
7378
return creds
7479

0 commit comments

Comments
 (0)