Skip to content

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

Description

@nnam-droid12

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions