https://github.com/sparkpost/appengine-flexible-python-sample
Sample app using Python, Flask and SparkPost in the Google App Engine flexible environment
https://github.com/sparkpost/appengine-flexible-python-sample
google-appengine python sparkpost
Last synced: 2 months ago
JSON representation
Sample app using Python, Flask and SparkPost in the Google App Engine flexible environment
- Host: GitHub
- URL: https://github.com/sparkpost/appengine-flexible-python-sample
- Owner: SparkPost
- License: other
- Created: 2017-04-12T10:44:47.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-27T19:50:04.000Z (almost 8 years ago)
- Last Synced: 2025-07-31T07:45:09.101Z (5 months ago)
- Topics: google-appengine, python, sparkpost
- Language: Python
- Size: 4.88 KB
- Stars: 1
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[Sign up](https://app.sparkpost.com/join?src=Dev-Website&sfdcid=70160000000pqBb) for a SparkPost account and visit our [Developer Hub](https://developers.sparkpost.com) for even more content.
This sample app demonstrates how to send email with Python and [python-sparkpost](https://github.com/SparkPost/python-sparkpost) on the Google App Engine flexible environment.
### Prerequisites
- a [Google Cloud Platform](https://cloud.google.com/) account
- the [Google Cloud SDK](https://cloud.google.com/sdk/) installed and configured
### Setup
1. Sign up for a SparkPost account [here](https://app.sparkpost.com/join).
1. Create an API key with *Transmissions: read/write* privilege [here](https://app.sparkpost.com/account/credentials).
1. Add your API key to `app.yaml`.
1. Optional: prepare an isolated Python virtual environment:
```sh
virtualenv env
source env/bin/activate
```
1. Install the app's dependencies:
```sh
pip install -r requirements
```
### Running Locally
1. Start the app:
```sh
SPARKPOST_API_KEY=your-api-key python main.py
```
1. Visit the app in your browser: [http://localhost:8080/](http://localhost:8080/)
### Deploying To Google App Engine
1. Deploy the app and dependencies to your Google Cloud project:
```sh
gcloud app deploy
```
1. Visit the app in your browser:
```sh
gcloud app browse
```
### Running The Tests
```sh
pip install pytest responses flaky
pytest main_test.py
```