Skip to content

Repository files navigation

Team Project (Team 70dub)

CodePlay is a competitive coding website with gamification elements for university students. Personal contribution:

  • Developed the "practice" feature which includes giving the users random programming problems, testing their solutions, and giving them rewards based on their performance.
  • Implemented such accessibility features as font size change and optional dyslexia font.
  • Configured the Django project for the team and prepared the setup instructions for development.

Website links (inactive)

Prerequisites / Dependencies

Using Python >3.10.4 features may break things.

  • pip v24.0 (may already be installed by default, but if you don't have it, here's how to get it)
  • Django v5.0.1
  • SQLite (comes together with Python)
  • asgiref v3.7.2
  • sqlparse v0.4.2
  • WhiteNoise v6.6.0
  • daphne v4.1.0
  • channels v4.0.0

There's no need to install anything but Python and pip manually. All the remaining dependencies will be installed straight into your virtual environment (read the section below).

Virtual Environment Setup (Windows, easily adaptable for Mac/Linux with a few google searches)

  1. Create a folder called venv in the root directory of the cloned repository.
  2. Navigate to the venv folder in the terminal.
  3. Run py -3.10 -m venv .. This should create the virtual environment files in venv.
  4. Activate the virtual environment using ./Scripts/activate
  5. Run pip install -r requirements.txt to install the dependencies.
  6. You can deactivate the virtual environment by running deactivate.

Make sure your virtual environment is always on when you're developing.

Django project and app setup instructions

Note: application != an entire project. One project (i.e. website) can (and, ideally, should) have multiple applications (e.g. authentication system, blog, dashboard, etc.). To ensure best development experience, create a new application for each feature.

  1. Run django-admin startproject codeplay in repo base directory to generate the foundation:
codeplay/              -    root directory for the whole project
    codeplay/          -    actual Python package for the project
        __init__.py    -    empty file that indicates this directory is a Python package
        asgi.py        -    entry point for ASGI web servers
        settings.py    -    project settings/config file
        urls.py        -    project URL declarations
        wsgi.py        -    entry point for WSGI web servers
    manage.py          -    command-line utility

  1. Run python manage.py runserver in the project root directory to start a local dev server on port 8000
  2. Run python manage.py startapp appname in root directory to generate the application structure:
appname/
    __init__.py
    admin.py
    apps.py
    migrations/
        __init__.py
    models.py
    tests.py
    views.py
  1. Create urls.py in the application directory for handing URLs.

Additional useful steps and commands

  • Run pip install -r requirements.txt to install dependencies via pip.
  • Run python manage.py migrate to create any necessary DB tables for settings.INSTALLED_APPS.
  • Run python manage.py makemigrations appname to create DB tables for each app.
  • Run python manage.py createsuperuser to create an admin user.
  • Run python manage.py collectstatic to dump all the static files into their special directory (required for static files to work in deployment).
  • Run python manage.py check --deploy to check if your project is ready for deployment.
  • Run $env:DJANGO_SETTINGS_MODULE="codeplay.settings.localdev" in the VS Code terminal while in the base directory to switch to development settings.
  • Run $env:DJANGO_SETTINGS_MODULE="codeplay.settings.deploy" in the VS Code terminal while in the base directory to switch to production settings.

Commit Instructions

  1. Only commits made to the prod-branch branch are pushed to prod.
  2. Your commits to the main branch will only be visible in the dev environment (not prod).
  3. The commits don't have to be tagged anymore.

About

UoBD Team Project website

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages