Skip to content

CarletonComputerScienceSociety/core

Repository files navigation

Core is the central application that powers many of our online services and events.


CI License: MIT


Table of Contents

Context

Core is a Django based application. We used Django to build this application because of Django's "app based" structure and Django's preconfigured dashboard system. The hope is that to avoid having to configure and run several microservices, we can instead create new Django apps.

Services

  • Django (Core Application)
  • PostgreSQL
  • RabbitMQ
  • Celery

Setup

Docker is recommended for application setup due to the high number of services required for this project.

Non-Docker Setup

0. Install virtualenv

pip install virtualenv

1. Create virtual environment

virtualenv venv -p python3

2. Activate virtual environment

For unix

source venv/bin/activate

For windows

venv\Scripts\activate

You will also need to know how to deactivate your virtual environment later, which can be done by running the following:

deactivate

3. Install Python dependencies

pip install -r requirements.txt

4. Update your Database configuration

Currently this application uses a postgres database, but for local development if may be quicker for you to use SQLite.

Open core/settings/base.py

If you would like to use SQLite, uncomment the SQLite config. If you would like to use postgres, enter your postgres information.

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": BASE_DIR / "db.sqlite3",
    }
}

# DATABASES = {
#    'default': {
#        'ENGINE': 'django.db.backends.postgresql',
#        'NAME': 'ccss_resources',
#        'USER': 'postgres',
#        'PASSWORD': '1234',
#        'HOST': 'ccss_resources_db',
#        'PORT': 5432,
#    }
# }

5. Configure Django Environment Settings

For unix

export DJANGO_SETTINGS_MODULE=core.settings.dev

For windows

set DJANGO_SETTINGS_MODULE=core.settings.dev

6. Migrate Database

python manage.py migrate

7. Start Django server

python manage.py runserver 0.0.0.0:8000

8. Start Rabbitmq (optional)

rabbitmq-server

9. Start Celery Worker (optional)

celery -A core worker -l info

Docker Setup

Everything in this application is preconfigured to use host names from our docker-compose.yml.

docker-compose up

Applications

Code Challenges

The Code Challenges app is used to manage code challenge events.


Resources

The Resources app controls the dynamic content on the CCSS website. This app was created so volunteers could easily populate the website with resources, links, jobs postings and more.


Useful Commands

Make migrations

python manage.py makemigrations PROJECTNAMEHERE

Make superuser

python manage.py createsuperuser

Create superuser in docker

docker exec -it DOCKERCONTAINERID python manage.py createsuperuser

Lint using Black

black .