Skip to content

[mirror] Rewriting of the (Flask-based) Members app in Django

License

Notifications You must be signed in to change notification settings

SPI/members-django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Members-django

This is the SPI membership web application, which lives at:

https://members.spi-inc.org/

It enables the following actions:

  • New member registration

Non-contributing members just need to apply for a new account and verify their email address.

  • Contributing member application

Once a user is a valid non-contributing member they can submit an application for contributing membership, providing details of why they meet the criteria.

  • Management of member applications

Users who are marked as application managers can review outstanding applications for contributing membership and approve or deny them as appropriate.

  • Centralized authentication system

The members applications acts as a centralized authentication system for SPI's mailing list system based on PGLister and its private archives based on PGArchives.

The app is written in Python using the Django frame work and designed to run on a Debian 12 (Bookworm) host.

The official code repository for the site lives within the SPI infrastructure and can be browsed at:

https://gitlab.com/spi-inc/members-django

There is also an unofficial mirrors in GitHub:

https://github.com/SPI/members-django

Patches can be emailed to [email protected] or submitted via the pull request feature on these sites.

Dependencies

  • python3
  • python3-django
  • postgresql
  • python3-psycopg2
  • pyenv
  • python-virtualenv
  • python-wxgtk3.0 # for OpenSTV

pip packages: see requirements.txt

Install

This is a role to deploy members in SPI's (currently private) ansible repository.

To redeploy, use:

ansible-playbook --vault-password-file .vault_pass.txt playbooks/leslie_jess.yml --tags members-django

Dev environment

Install venv:

CC=clang pyenv install 3.11.2
virtualenv -p ~/.pyenv/versions/3.11.2/bin/python3 venv
source ./venv/bin/activate
pip install django==4.2
python -m django --version  # Should be 4.2
pip install psycopg2-binary requests pycryptodomex

Create database:

sudo -u postgres psql -c 'create role <username>' ; sudo -u postgres psql -c 'create database membersdjango'
python manage.py migrate

You can also use the ansible script to deploy the application in a testing or production environment.

Tests

To run tests, the current user must have the rights to create a database. In postgres, run:

alter user <USERNAME> CREATEDB;

In the right venv, they can then be run using:

PYTHONPATH=membersapp/app/OpenSTV/openstv python manage.py test

Link between Membersdjango, PGLister and PGArchives

To authenticate users in PGLister and PGArchives-private, a community auth site must be created in Membersdjango. First, create a community org auth in /admin/account/communityauthorg/. Then, create the auth site in /admin/account/communityauthsite/.

Use the following parameters:

Then add the correct information in membersdjango's settings.py (or local_settings.py):

USE_PG_COMMUNITY_AUTH = True
PGAUTH_REDIRECT = "https://members.spi-inc.org/account/auth/1/""
PGAUTH_KEY = "YOUR_CRYPTKEY"
LOGIN_URL = "/accounts/login/"

Scripts

There are several scripts to handle the links between these different components.

  • email-stats: send email containing stats on members and applications
  • email-voters: email contributing members about open votes
  • cleanup-contrib: deal with sending notifications to or cleaning up inactive SPI contributing members
  • subprivate: prompt the members application for contributing members list and subscribe them to the spi-private mailing list

Add these as cron jobs such as:

  • email-stats, email-voters and cleanup-contrib (ping and clean) are running in the context of the membersdjango application
  • subprivate is running in the context of PGLister

About

[mirror] Rewriting of the (Flask-based) Members app in Django

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published