This repository has been archived on 2022-08-01. You can view files and clone it, but cannot push or open issues or pull requests.
DEMOS2/README.md

84 lines
2.9 KiB
Markdown
Raw Permalink Normal View History

2022-08-01 15:04:50 +00:00
Forked from [GitHub:vincentmdealmeida/DEMOS2](https://github.com/vincentmdealmeida/DEMOS2)
# DEMOS2
2018-07-16 09:52:39 +00:00
Prototype Django-based e-voting application, to demonstrate DEMOS2's client-side
encryption e-voting.
2018-07-16 09:52:39 +00:00
The previous repository for DEMOS2 by Carey Williams can be found at:
https://github.com/CareyJWilliams/DEMOS2
## Setup
### Main Application Dependencies
2018-08-29 13:44:37 +00:00
* Python
* Version 2.7; anything higher than this will not currently work
* All Python packages specified in `requirements.txt`; PyCharm will detect these dependencies and offer installation
* MySQL Server: Community Edition
* Initialise with 'legacy password authentication'
* Create a new MySQL DB user with the default username and password specified in `aullauthdemo/settings.py`
* Create a new MySQL DB called `demos2` (also specified in `aullauthdemo/settings.py`), making sure to set the charset to 'UTF8'
2018-07-16 09:52:39 +00:00
### Database setup
After installing the above dependencies, issue the following command to initialise the DB:
2018-07-16 09:52:39 +00:00
```
python manage.py migrate
```
2018-07-16 09:52:39 +00:00
The first run will produce a `django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')` error. Issue the command a second time and it will complete successfully.
2018-07-16 09:52:39 +00:00
### Settings
`allauthdemo/settings.py` specifies the Google reCAPTCHA site key and private key, which will need changing when deployed onto a new domain.
There is also a `DOMAIN` setting within the file that needs updating during deployment as things like email functionality depend on this setting for correct URL generation during event preparation etc.
Emails from the application are currently sent from the following email account which can be updated within the settings:
2018-07-16 09:52:39 +00:00
```
demos2.no.reply@gmail.com
```
### NodeJS Dependencies
2018-07-16 09:52:39 +00:00
The Node.js crypto server depends on the `milagro-crypto-js` and `express` modules. A `package.json` file can be found in the `Node/` directory with these dependency requirements and therefore from this folder you can run:
2018-07-16 09:52:39 +00:00
```
npm install
```
Once the dependencies have been installed, you can then run the node server as per the below instructions.
2018-07-16 09:53:16 +00:00
## Instructions
2018-07-16 09:52:39 +00:00
### Step 1: Running the Python app and creating a new user account
You can run the server with the following command:
2018-07-16 09:52:39 +00:00
```
python manage.py runserver
```
2018-07-16 09:52:39 +00:00
The application will then be available at `127.0.0.1:8000`.
You can then click on 'Join' to create a new user account.
### Step 2: Running the Node.js Server
The Node.js server exposes a lot of cryptographic operations that the application depends on throughout. To run the server, issue the following command line request from the `Node/` folder:
2018-07-16 09:52:39 +00:00
```
node index.js
2018-07-16 09:52:39 +00:00
```
### Step 3: Running Celery
Celery is used to run tasks asynchronously and the DEMOS2 application can't run without this application. A bash script called `start_celery_worker.sh` is provided to make starting a worker as easy as possible:
2018-07-16 09:52:39 +00:00
```
./start_celery_worker.sh
2018-07-16 09:52:39 +00:00
```