Using Google Cloud SDK in Django Developement and UWSGI

Hi All,

I am trying to access Google Cloud Service in my backend process ( I have successfully run this in developement server. Here is my script :

from import bigquery

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

     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 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 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