Because collecting emails should be easy.
What is it?
A simple dump for your email signups.
I'm a programmer. Talk nerdy to me.
It's a simple Flask application using Gevent that persists signups in a MongoDB database. It's meant to be hosted on Heroku with the MongoLab add-on.
How do I use it?
git clone https://github.com/dskang/email-bin.git
heroku addons:add mongolab
git push heroku master
- Once you have the server running on Heroku, you can simply create a form with a text field and submit button anywhere* and set the 'action' attribute to YOUR-HEROKU-APP-URL/signup. Look inside the example directory for help. In other words, all you need is add the following snippet to your site:
<form class="email-form" method="post" action="<YOUR-HEROKU-APP-URL>/signup"> <input class="email" name="email" type="text" placeholder="Email address"> <button class="submit" type="submit">Sign up</button> </form>
*Email Bin allows cross domain requests, so Email Bin does not need to
reside on the same domain as your actual site. This means that
XMLHttpRequests can be invoked from any domain; if you would like to
restrict the domains that are allowed to do this, change the
ALLOWED_DOMAINS in app.py to the URL of the site containing your form.
I want to develop locally.
pip install -r requirements.txtIf you have issues installing gevent, run
brew install libevent.
heroku config | grep MONGOLAB_URIand copy the MONGOLAB_URI into a new file named .env, using sample.env as a guide.