/OpenSalve

A project to help disaster-relief efforts

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

OpenSalve

Setup

After cloning the repo,

  • Setup virtualenvwrapper
  • With the repo folder as the present working directory, setup the environment :
    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    source ~/.local/bin/virtualenvwrapper.sh # Better add this to .bashrc
    mkvirtualenv opensalve
    rm $VIRTUAL_ENV/bin/postactivate
    ln -s `realpath .env/postactivate` $VIRTUAL_ENV/bin/postactivate
  • Edit file .env/postactivate and set SECRET_KEY, database config
  • Activate environment :
    source ~/.local/bin/virtualenvwrapper.sh # Better add this to .bashrc
    workon opensalve
  • Install dependencies (pip install Django djangorestframework drf-yasg flex swagger_spec_validator) :
    pip install -r requirements.txt
  • Open file .env/bin/postactivate and set secret key :
    export DJANGO_SECRET_KEY='a_random_key_here'
  • Migrate :
    python3 manage.py makemigrations && python3 manage.py migrate
  • Start server :
    python3 manage.py runserver

Contributing

TODO

  • User Accounts
    • Login/Register
    • User Roles
  • Help Requests
    • Register request
    • Get request complete info
    • Resolve request
    • Status of request
    • Comments on request
    • Visualize request in maps
    • Editing requests
    • Prioritizing Requests
    • Live location with GPS
  • Camps
    • Add & List
    • Camp requirements
  • Collection Centres
    • Add & List
    • Supplies required

API Docs

Use an interactive API documentation from /docs after setting up OpenSalve locally on http://127.0.0.1:8000.

Or use the online API docs.

Steps to generate static API docs :

  • Install spectacle-docs :
    npm install -g spectacle-docs
  • Save the OpenAPI in JSON format to api.json file (where http://127.0.0.1:8000 is where OpenSalve is running) :
    curl http://127.0.0.1:8000/docs/?format=openapi > api.json
    
  • Generate docs :
    spectacle api.json -t docs
    
  • Cleanup :
    rm api.json
    

Or use this one liner :

curl http://127.0.0.1:8000/docs/?format=openapi > api.json && spectacle api.json -t docs && rm api.json