Giter VIP home page Giter VIP logo

la-mailer's Introduction

Politician Mailer

Website is up! www.blacklives.email

Generates a message based on github.com/alandgton/activism-mail-bot (based on template from https://nomoreracistcops.github.io) and prepares an email in mail app to send to 500 elected officials. frontend taken from github.com/michaelnyu/la-mailer.

To run source code :

  1. Install NPM, Flask, Node.js, Gatsby, and Nginx
  2. Run 'npm run build && npm run serve' in terminal
  3. cd into emails folder (in assets folder)
  4. Run 'export FLASK_APP=messages.py'
  5. Run 'flask run'
  6. Implement a reverse proxy (so that flask and npm servers can communicate without CORS issues due to their different ports)

To implement the reverse proxy, assuming npm is on port 9000 and flask on 5000:

Add the following to server section of nginx.conf

server {
    listen       8080;
    server_name  localhost;

    #charset koi8-r;                                                                                                                                                                                                                      

    #access_log  logs/host.access.log  main;                                                                                                                                                                                              

    location / {
        #root   html;                                                                                                                                                                                                                     
        #index  index.html index.htm;                                                                                                                                                                                                     
        proxy_pass http://localhost:9000;
    }

    location /p/ {
        #redirect any url beginning with /p/ to port 5000                                                                                                                                                                                 
      proxy_pass http://localhost:5000;
    }

...rest of server section is irrelevant

This redirects URLs starting with / (so all URLs) to the npm server running on port 9000. Except when a URL starts with /p/ it is directed to the flask server running on port 5000.

Thus, all calls to the Python scripts running on the flask server must start with /p/, and the python scripts must only take URLs that start with /p/

  1. Run nginx
  2. Then, the website will be visible at http://localhost:8080

la-mailer's People

Contributors

nkhalsa avatar michaelnyu avatar wongbryan avatar lilyhlou avatar jl98 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.