Skip to content
Advertisement

TWILIO API ERROR Credentials are required to create a TwilioClient django

I am trying to include TWILIO API to my project. It should send sms. I have finished tutorial, but then i get error Credentials are required to create a TwilioClient. I have credentials in .env file and then i try to import them to settings and then get this credentials from settings to views.

This is when i get error.

.env

JavaScript

settings.py

JavaScript

views

JavaScript

and here is when code work, but i want to import this from settings..

JavaScript

Any idea how to solve this?

Advertisement

Answer

So you are using a .env file rather than setting your OS’s environmental variables? If so, there is and article below, pointing to https://github.com/theskumar/python-dotenv.

How To Set Environment Variables

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement