0

Having some issues getting a web app up and running. You can see this project running live online at yx8dxjwh.apps.lair.io but as soon as I imported it into pyCharm I am presented with a key error for the api. Please see below:

python manage.py runserver

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x04678078>
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\airtable\auth.py", line 37, in __init__
    self.api_key = api_key or os.environ['AIRTABLE_API_KEY']
  File "C:\Program Files (x86)\Python36-32\lib\os.py", line 669, in __getitem__
    raise KeyError(key) from None
KeyError: 'AIRTABLE_API_KEY'

There is a mass of other errors too but I feel like this is the main one and could potentially solve the rest of them.

Any help would be appreciated.

balter
  • 25
  • 1
  • 9

1 Answers1

0

You don't have the environment variable set for AIRTABLE_API_KEY. The SDK you are using leverages that environment variable by default. You can read more at: https://airtable-python-wrapper.readthedocs.io/en/master/authentication.html

And then this link can help you find your Airtable API Key if you don't have it: https://support.airtable.com/hc/en-us/articles/219046777-How-do-I-get-my-API-key-

TheF1rstPancake
  • 2,318
  • 17
  • 17
  • Thanks so much for the reply... I have added the environment variable but still have the same problems.... Any other suggestions? – balter Nov 23 '18 at 04:12
  • The error you are getting is pretty clear that the environment variable is not set. It may have something to do with PyCharm, so you can look at this related question: https://stackoverflow.com/questions/21538859/pycharm-set-environment-variable-for-run-manage-py-task/22899916 – TheF1rstPancake Nov 23 '18 at 17:01
  • Thanks for the help... The environment variable are definitely set, ive tried both a .env file and within pycharm itself. Ill most certainly have a look at the script from the link you provided. Thanks again :) – balter Nov 25 '18 at 03:02