How to get a YAML file containing api keys to work in django?

532 views Asked by At

I'm new to django and I am trying to make an API call to ebay when a user clicks a button, using ebay python SDK. There is a YAML file inside my project which contains the api keys. In my app, I have a python file that contains a function that makes the api call. When I run the function that python file separately, it works fine and finds the YAML file no problem. But when I try to run that same function from views.py, it gives me an error that says - config file 'ebay.yaml' not found. Can anyone please help me with this as I have no idea what's wrong... Do I have to do anything special when running the API call through django, besides just having a YAML file in the same direcotry?

1

There are 1 answers

0
Driss ait On BEST ANSWER

Your ebay.yaml file should be in the same directory as manage.py in order to work properly.

Here is an example:

folder/
  ebay.yaml
  manage.py