Use Twilio to send SMS alerts so that you never miss a critical issue.
This project is built using the Django web framework. It runs on Python 3.6+.
To run the app locally, first clone this repository and cd into its directory. Then:
-
Create a new virtual environment:
-
If using vanilla with Python 3 virtualenv:
python -m venv venv source venv/bin/activate -
If using virtualenvwrapper:
mkvirtualenv server-notifications-django
-
-
Install the requirements:
pip install -r requirements.txt -
Copy the
.env.examplefile to.env, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice) -
For the TWILIO_NUMBER variable you'll need to provision a new number in the Manage Numbers page under your account. The phone number should be in E.164 format
-
(Optional) This project integrate python-dotenv to automatically load the
.envfile. Alternatively, you can runsource .envto apply the environment variables (or even use autoenv) -
Customize
config/administrators.jsonwith your phone number. -
Start the development server
python manage.py runserver -
Go to http://localhost:8000/error. You'll receive a text shortly with details on the exception.
Note: To enable debug logs in local environment, set the DEBUG variable to True in the local.py file
Follow previous guide and in step 3 do:
- Copy the
.env.production.examplefile to.env, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice) and add theDJANGO_SECRET_KEY
You can run the tests locally through coverage:
$ coverage run manage.py test --settings=twilio_sample_project.settings.test
You can then view the results with coverage report or build an HTML report with coverage html.