Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

TwilioDevEd/eta-notifications-flask

Repository files navigation

ETA Notifications for Python - Flask

ETA notifications implementation with Python - Flask and Twilio.

Local development

This project is built using the Flask web framework. It runs on Python 2.7+ and Python 3.4+.

To run the app locally, first clone this repository and cd into its directory. Then:

  1. Create and activate a new python3 virtual environment.

    python3 -m venv venv
    source venv/bin/activate
  2. Install the requirements:

    pip install -r requirements.txt
  3. Copy the sample configuration file and edit it to match your configuration.

    cp .env.example .env

    Twilio API credentials can be found here and find you can create a REST API Key here. If using the twilio CLI you can run:

    twilio api:core:keys:create --friendly-name=worm-transfer -o json

    Copy or create a Twilio phone number from here.

  4. Run the migrations with:

    python manage.py db upgrade
  5. Modify seed data:

    We have provided an example of name and phone number in the seed data. In order for the application to send sms notifications, you must edit this seed data providing a real phone number where you want the sms notifications to be received.

    In order to do this, you must modify this file that is located at: project_root/manage.py

  6. Seed the database:

    python manage.py dbseed
  7. Expose your application to the wider internet using ngrok. You can click here for more details. This step is important because the application won't work as expected if you run it through localhost.

    ngrok http 5000
  8. Start the development server:

    python manage.py runserver

Once Ngrok is running, open up your browser and go to your Ngrok URL. It will look like this: http://9a159ccf.ngrok.io

That's it!

Run the tests

python manage.py test

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.