Skip to content

Website for MeDUSA, Deakin University's medical student's society

License

Notifications You must be signed in to change notification settings

DeakinMeDUSA/medusa_website

Repository files navigation

Deploy License: MIT Code style: black

MeDUSA Website

Website for MeDUSA, Deakin University's medical student society, hosted here

License : MIT

Installation

Pre-prerequisites

Install

Install python requirements:

poetry install
poetry shell
playwright install-deps
playwright install

Install node requirements

npm install

Create database, where postgres is the default postgres account:

createdb -U postgres medusa_website

After creating, in the top level .env file, set the values to what you just used:

DATABASE_URL="postgres://localhost/medusa_website"
DATABASE_USER="postgres"
DATABASE_PASSWORD="postgres"

Run migrations:

poetry shell # To activate virtualenv
python manage.py migrate

Setup pre-commit:

poetry run pre-commit run --all-files

Check install worked

python start_console.py

To run celery worker

poetry run celery -A medusa_website worker --loglevel=INFO

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.

Type checks

Running type checks with mypy:

$ mypy medusa_website

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 py.test

$ pytest

Live reloading and Sass CSS compilation

Moved to Live reloading and SASS compilation .

Other scripts used

gunicorn.service

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=medusa_it
Group=www-data
WorkingDirectory=/home/medusa_it/medusa_website
ExecStart=/home/medusa_it/.cache/pypoetry/virtualenvs/medusa-website-GIn7jO6M-py3.9/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          config.wsgi:application

[Install]
WantedBy=multi-user.target

And celery.service

[Unit]
Description=Celery Beat Service
After=network.target

[Service]
Type=simple
User=celery
Group=celery
EnvironmentFile=/etc/conf.d/celery
WorkingDirectory=/home/medusa_it/medusa_website
ExecStart=/bin/sh -c '${CELERY_BIN} -A ${CELERY_APP} beat  \
    --pidfile=${CELERYBEAT_PID_FILE} \
    --logfile=${CELERYBEAT_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL}'
Restart=always

[Install]
WantedBy=multi-user.target