Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'Api_key' not defined in Django #38

Open
nnam-droid12 opened this issue Feb 10, 2021 · 0 comments
Open

NameError: name 'Api_key' not defined in Django #38

nnam-droid12 opened this issue Feb 10, 2021 · 0 comments

Comments

@nnam-droid12
Copy link

I have set an environment variables for my api_key and api_secret using Python decouple in settings.py
From decouple import config

API_KEY = config('API_KEY)
API_SECRET = config('API_SECRET')
While in the .env file I added the key and secret as shown below
API_KEY=***********
API_SECRET=*********
While in my views.py I'm using api_key and api_secret but I don't really know how to call the API key and secret from settings.py when I removed it from settings.py and I added it to views.py I got a type error saying bytes or bytearray expected but got str

Pls how can I call the this api_key and secret from settings.py since I have set up an environment variable already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant