Skip to content

A grassroots-developed system that helps with matching refugees with hosts willing to provide housing in times of need.

License

Notifications You must be signed in to change notification settings

tadeoos/house-of-refuge

Repository files navigation

House of Refuge

Built with Cookiecutter Django Black code style

License: MIT

This app provides a system that helps with matching refugees and hosts willing to provide housing in times of need. It was first developed for Grupa Zasoby – a local grassroots initiative in Warsaw that started with a facebook group on 24th of February, 2022.

Provided functionality:

  1. Gathering data via two different forms:

    1. Host can fill in the "resource" form: the type, availability, duration, contact information etc.
    2. A refugee (or someone acting on their behalf) can fill in the "submission" form: number of people, duration etc.

    These are open to the public and can be seen at https://grupazasoby.pl

  2. Dashboard for processing submissions:

    The actual users of the system are the volunteers who are processing the data mentioned above. The main entrypoint for the volunteers is at /jazda url. There exists a dashboard view providing the list of all submissions which can be filtered by different attributes. Each submission has a status and a corresponding actions. Volunteer can start searching for a potential host by clicking on an appropriate button on the submission. This will render another view: a list of potential hosts which can also be filtered, searched etc. Volunteer then calls a potential host and if they agreed to take someone in the submission transitions into "host found" state for later processing. We plan to add a dedicated file explaining the details of this whole process in the near future.

  3. Stats view at the url /statsy which contains various graphs and data which can inform decisions about the best shift hours, team performance etc.

This project is actively developed and a lot is changing daily. We are open sourcing this repo in order to make it easier for other initiatives to fork, customize, and run their own instance. We're providing this code on "as is" basis. We're planning to add better documentation in the near future as time allows.

Contributing

The default use case for an organization wanting to incorporate our process in their own work is to find a technical person with knowledge of Python, Django and React who will then fork this repository, customize the code to better suit their needs, and then deploy and maintain a production instance of their own.

If you just want to help and contribute to this repository, please fork it and create pull requests against the master branch. It's a good idea to browse open issues for a place to start.

Setting up local development

  1. Fork and clone this repository
  2. You need a local postgres server (either 13 or 14 version is fine), if you're on Mac we recommend using Postgress.app
    createdb --username=postgres house_of_refuge
    
  3. Create local python environment and install dependencies
    python -m venv venv
    . ./venv/bin/activate
    pip install -r requirements/local.txt
    
  4. Build React frontend
    cd house_of_refuge/frontend
    npm install
    npm start
    
  5. Run migrations, compile translations, create local data and start dev server
    python manage.py migrate
    python manage.py compilemessages
    python manage.py generate_local_data
    python manage.py createsuperuser
    python manage.py runserver_plus
    

Settings

Moved to settings.

Basic Commands

Setting Up Your Users

  • To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.

  • To create an superuser account, use this command:

    python manage.py createsuperuser
    

For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.

Creating local data

There is a management command to populate your local db with data for ease of development:

python manage.py generate_local_data --help

Test coverage

To run the tests, check your test coverage, and generate an HTML coverage report:

coverage run -m pytest
coverage html
open htmlcov/index.html

Running tests with pytest

pytest

Celery

This app comes with Celery but as of now we're not using it.

To run a celery worker:

cd house_of_refuge
celery -A config.celery_app worker -l info

Please note: For Celery's import magic to work, it is important where the celery commands are run. If you are in the same folder with manage.py, you should be right.

Email Server

In development, it is often nice to be able to see emails that are being sent from your application. If you choose to use MailHog when generating the project a local SMTP server with a web interface will be available.

  1. Download the latest MailHog release for your OS.

  2. Rename the build to MailHog.

  3. Copy the file to the project root.

  4. Make it executable:

    chmod +x MailHog
    
  5. Spin up another terminal window and start it there:

    ./MailHog
    
  6. Check out http://127.0.0.1:8025/ to see how it goes.

Now you have your own mail server running locally, ready to receive whatever you send it.

Sentry

Sentry is an error logging aggregator service. You can sign up for a free account at https://sentry.io/signup/?code=cookiecutter or download and host it yourself. The system is set up with reasonable defaults, including 404 logging and integration with the WSGI application.

You must set the DSN url in production.

Deployment

This app is configured to use Render for a production server. The render blueprint is defined in render.yaml file in the repo root.

We also recommend using New Relic for app monitoring.

Contact

In case you need any help reach out to grupazasoby at gmail.com or tadekte at gmail.com

About

A grassroots-developed system that helps with matching refugees with hosts willing to provide housing in times of need.

Topics

Resources

License

Stars

Watchers

Forks