When we announced our partnership with Nitrous, we showed how to send email with Rails. The platform-as-a-service and web-based IDE also currently supports Python, Node.js, Go, and PHP. In this tutorial, I’ll show how to use a Python development box on Nitrous to send email using SendGrid.
Get Started with Nitrous.IO / Python
- From the Nitrous New Boxes Page, create a new box using Python/Django
- Launch the IDE and go to the workspace folder in the Nitrous.IO terminal console.
- Clone the SendGrid sample application:
git clone https://github.com/sendgrid/sendgrid-python-django-sample-app.git
- Install the SendGrid Python library:
pip install --user sendgrid==0.3.1
The Python package manager will already be installed because Nitrous.IO pre-configures the boxes with software needed for each environment.
- In the Nitrous.IO file browser, open SGapp/settings.py and change the username/password data to be your SendGrid credentials.
- In the console go to “sendgrid-python-django-sample-app” folder and run the following command: ‘python manage.py runserver 0.0.0.0:8080’ to start the python server
- Go to ‘Preview’ menu and select ‘Port 8080’ and the sample application will be opened in your browser.
- Send your first email through SendGrid/Nitrous.IO by filling out the form. Now go check your email.
Your message will be there, waiting for you. This is obviously a simple example application. When you use SendGrid in your production Python apps, you’ll likely be sending social notifications, password resets and other transactional email. Use this project as a starting point or reference for sending email with SendGrid in Python on Nitrous.IO.