From b65270a83fb2cd10004eccd44bd63169580fbecb Mon Sep 17 00:00:00 2001 From: Sebastian Arias Date: Thu, 28 Oct 2021 11:46:26 -0500 Subject: [PATCH 1/2] Update files and instructions for running in production environment --- .env_example => .env.example | 0 .env.production.example | 12 ++++++++++++ README.md | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) rename .env_example => .env.example (100%) create mode 100644 .env.production.example diff --git a/.env_example b/.env.example similarity index 100% rename from .env_example rename to .env.example diff --git a/.env.production.example b/.env.production.example new file mode 100644 index 0000000..6f421e8 --- /dev/null +++ b/.env.production.example @@ -0,0 +1,12 @@ +# Environment variables for server-notifications-django + +# Django settings to use in this environment +export DJANGO_SETTINGS_MODULE=twilio_sample_project.settings.production +export DJANGO_SECRET_KEY=YOUR_SECRET_KEY + +# Twilio API credentials +export TWILIO_ACCOUNT_SID=ACXXXXXXXXXXXXXXXXX +export TWILIO_AUTH_TOKEN=YYYYYYYYYYYYYYYYYY + +# Twilio sending number +export TWILIO_NUMBER=+1555555505 diff --git a/README.md b/README.md index 124a946..4efbb73 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ To run the app locally, first clone this repository and `cd` into its directory. pip install -r requirements.txt ``` -1. Copy the `.env_example` file to `.env`, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice) +1. Copy the `.env.example` file to `.env`, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice) 1. For the TWILIO_NUMBER variable you'll need to provision a new number in the [Manage Numbers page](https://www.twilio.com/user/account/phone-numbers/incoming) under your account. The phone number should be in E.164 format 1. (Optional) This project integrate [python-dotenv](https://github.com/theskumar/python-dotenv) to automatically load the `.env` file. Alternatively, you can run `source .env` to apply the environment variables (or even use [autoenv](https://github.com/kennethreitz/autoenv)) 1. Customize `config/administrators.json` with your phone number. @@ -44,6 +44,12 @@ To run the app locally, first clone this repository and `cd` into its directory. ``` 1. Go to [http://localhost:8000/error](http://localhost:8000/error/). You'll receive a text shortly with details on the exception. +### Use Production Environment + +Follow previous guide and in step 3 do: + +1. Copy the `.env.production.example` file to `.env`, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice) + ## Run the tests You can run the tests locally through [coverage](http://coverage.readthedocs.org/): From 64a8d6308ad1dc6da4fb1f99f5aa32ee0bcbadb4 Mon Sep 17 00:00:00 2001 From: Sebastian Arias Date: Thu, 28 Oct 2021 16:32:44 -0500 Subject: [PATCH 2/2] Update Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4efbb73..1d032d7 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ To run the app locally, first clone this repository and `cd` into its directory. Follow previous guide and in step 3 do: -1. Copy the `.env.production.example` file to `.env`, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice) +1. Copy the `.env.production.example` file to `.env`, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice) and add the `DJANGO_SECRET_KEY` ## Run the tests