Q:

django NameError: name 'os' is not defined

When I try to follow this tutorial to install google-auth2 on my django 1.4 I get this error:

Traceback (most recent call last):
    File "./manage.py", line 11, in 
      import settings
    File "/home/ubuntu/xx/settings.py", line 140, in 
      GOOGLE_OAUTH2_CLIENT_ID = os.environ['GOOGLE_OAUTH2_CLIENT_ID']
  NameError: name 'os' is not defined

this line is:

139- LOGIN_REDIRECT_URL = '/'
140- GOOGLE_OAUTH2_CLIENT_ID = os.environ['GOOGLE_OAUTH2_CLIENT_ID']
141- GOOGLE_OAUTH2_CLIENT_SECRET = os.environ['GOOGLE_OAUTH2_CLIENT_SECRET']
  142- GOOGLE_WHITE_LISTED_DOMAINS = ['mydomain.org']
  SOCIAL_AUTH_USER_MODEL = 'auth.User'

Any ideas? Thanks
[Edit] Solved - a few other issues are in the comments.

A:

You try to use something from module os, which is not imported, thus you cannot use it -> add its import somewhere at the beggining of 'settings.py':
import os

edit:
if you don't have GOOGLE_OAUTH2_CLIENT_ID in os.environ, don't load it from there, set it directly in settings.py instead:
GOOGLE_OAUTH2_CLIENT_ID = 'your-actual-client-id-value'

