- 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
- In
frontend/src/config.js
, change config.api to the URL of the Django server
- Upload
backend/
to your instance - Run
pip install -r requirements.txt
- 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
- Run
npm install
infrontend/
- Run
npm run build
infrontend/
- Upload
frontend/dist/*
to your htdocs directory
- Install mod_wsgi for apache
- Load mod_wsgi in httpd.conf
- 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>
- 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>
- Restart httpd