Hi All,
I am trying to access Google Cloud Service in my backend process (views.py). I have successfully run this in developement server. Here is my views.py script :
from google.cloud import bigquery
@login_required
def update_iphone(request):
user_profile = UserProfile.objects.get(user=request.user)
client = bigquery.Client()
if request.method == 'POST':
form = IphoneUpdateForm(request.POST)
if form.is_valid():
sql = f"""
query script
"""
client.query(sql)
else:
pass
sql = f"""
query script
"""
corporate_list = client.query(sql).to_dataframe()
iphone_form = IphoneUpdateForm()
return render(request, 'myapp/home.html', {'user_name':user_profile.first_name,
'corporate_list': corporate_list['corporate_name'].to_list(),
'form': iphone_form})
This views.py script runs well in development server. But if try to run it with UWSGI, I am getting error related to the google cloud as following :
google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
My question is why am I getting this error if using UWSGI and not the development server ? how do I deal with this error ?
Thank You