UWCS Vote is the voting portal for UWCS elections and general meetings.
UWCS Vote is built and tested against Python 3.8/3.9, using Django as the web framework and PostgreSQL for the database.
- Create a new virtual environment.
python -m venv venv
- Activate the virtual environment
- On Linux and macOS:
source venv/bin/activate
. - On Windows:
.\venv\Scripts\activate
.
- On Linux and macOS:
- Confirm the virtual environment has been activated.
- On Linux and macOS:
which python
.
Expected output:.../venv/bin/python
. - On Windows:
where.exe python
.
Expected output:...\venv\Scripts\python.exe
.
- On Linux and macOS:
- Install dependencies.
pip install -r requirements.txt
. - Ensure all settings in
settings.py
are up to date: - Create a database for UWCS Vote to run on.
On postgres:CREATE USER uwcs_vote WITH PASSWORD 'password';
CREATE DATABASE uwcs_vote WITH ONWER = uwcs_vote;
- Prepare the database by running migrations with
python manage.py migrate
. - Create a superuser for the site with
python manage.py createsuperuser
. - Create the configuration file(s) for the web server of your choosing (do not worry about this step if you are running locally).
Start the web server. If you are running locally, you can use the command python manage.py runserver
UWCS Vote uses django-allauth to operate a single sign-on system with the UWCS website (at the time of writing, this is Dextre). To set this up, follow these instructions:
- Create an application within the Django admin in the UWCS website. Use the following settings as an example:
- Name:
UWCS Vote
- User: click search and search for your user
- Redirect URLs: follow the format of
http(s)://yourdomain.com/accounts/uwcs/login/callback/
- Client type: Public
- Authorisation grant type: Authorisation code
- Name: UWCS Vote
- Name:
- Edit the "example.com" site in the Django admin in UWCS Vote, with the domain as your domain (e.g.
localhost:8000
) and give it a useful label. - Create a "social application" in the Django admin in UWCS Vote.
- Provider: UWCS
- Name: UWCS Website
- Client id: copy from your new application
- Secret key: copy from your new application
- Sites: select the site with your domain
- Errors installing Psycopg are likely due to missing dependencies to compile the library.
It requires the
Python.h
header file, typically provided by a package calledpython3-dev
. It also requireslibpq-fe.h
, typically contained inlibpq-dev
.- Alternately, it can be replaced with
psycopg-binary
.
- Alternately, it can be replaced with
- If you require anything created in the UWCS website (e.g. an OAuth Application), please speak to someone with superuser privileges (currently this is Josh or the Tech Officer)