Giter Club home page Giter Club logo

impactbrazil's Introduction

Impact Brazil

Configuration

  1. Create backend/config.py
db_host = DB_HOST  # Optional
dbname = DB_NAME
dbuser = DB_USER
dbpass = DB_PASSWORD
prod = False  # True on Prod 
entity_gis_id = 1606  # ID of Brazil on GIS
secret_key = SECRET_KEY  # Set a secret key for Django here
  1. In frontend/src/config.js, change config.api to the URL of the Django server

Backend Setup

  1. Upload backend/ to your instance
  2. Run pip install -r requirements.txt
  3. Set up crontab to refresh the database periodically, example below
0 */2 * * * /home/ec2-user/impact/backend/venv/bin/python3 /home/ec2-user/impact/backend/manage.py acquire_opps
0 8 * * * /home/ec2-user/impact/backend/venv/bin/python3 /home/ec2-user/impact/backend/manage.py acquire_analytics

Frontend setup

  1. Run npm install in frontend/
  2. Run npm run build in frontend/
  3. Upload frontend/dist/* to your htdocs directory

Serving

  1. Install mod_wsgi for apache
  2. Load mod_wsgi in httpd.conf
  3. Configure Apache to serve Django server, example below
<VirtualHost _default_:80>
        Alias /static/admin /home/ec2-user/impact/backend/venv/lib/python3.6/site-packages/django/contrib/admin/static/admin
        <Directory /home/ec2-user/impact/backend/venv/lib/python3.6/site-packages/django/contrib/admin/static/admin>
                Require all granted

        <Directory /home/ec2-user/impact/backend/backend>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

        WSGIDaemonProcess backend python-home=/home/ec2-user/impact/backend/venv python-path=/home/ec2-user/impact/backend
        WSGIProcessGroup backend
        WSGIScriptAlias /api /home/ec2-user/impact/backend/backend/wsgi.py

</VirtualHost>
  1. In htdocs/, create .htaccess to ensure HistoryMode is being handled in Vue
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>
  1. Restart httpd

impactbrazil's People

Contributors

rnavroze avatar

Watchers

James Cloos avatar  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.