Skip to content

uowcodingsociety/website

Repository files navigation

codesocWebsite

Warwick Codesoc website. Built using Flask. Originally owned by Warwick Coding Society's founder Adriano Barbet and contributed to by ex-Presidents Piotr Zychlinksi and Alfie-Joe Smith.

Quickstart

  • Changes to blog posts, exec members, sponsor news and sponsors can be made in the data/ directory.
  • Add events via the Warwick Coding Society GMail account in the Google Calendar.
    • Valid event prefixes include:
      • careers@
      • courses@
      • event@
      • social@
    • So for example, event@ CodeSoc Pub Night

How to run

  • First download the code from the repository
  • Ensure both clean.sh and setup.sh have execute permissions, you can do this with chmod u+x scriptname.sh
  • Run the setup.sh script to install required dependancies. You must have python3 installed for this to work
  • Start the virtual environment by running . venv/bin/activate
  • Install dependencies with pip install -r requirements.txt
  • Define the file to run using export FLASK_APP=codesoc.py
  • Build the database with python -m flask db-reset
  • Run the development server with python -m flask run

You should now be able to view the website on the address specified by the server output, usually 127.0.0.1:5000

Development

Make sure your dependencies are installed:

./setup.sh
. venv/bin/activate
python -m pip install requirements.txt

You can validate data changes in the data/ directory by using the flask command:

python -m flask db-validate

You can regenerate the SQLite database with:

python -m flask db-reset

Database Migrations

When making changes to the database schema (models in db_schema.py):

  1. Create a migration after modifying the models:

    export FLASK_APP=codesoc.py
    flask db migrate -m "Description of your changes"
  2. Apply the migration:

    flask db upgrade
  3. Reset database with new schema:

    flask db-reset

Troubleshooting Migrations

If you encounter migration conflicts or "table already exists" errors:

  1. Check current migration status:

    flask db current
  2. If database is inconsistent, stamp it as current:

    flask db stamp head
  3. Then create and apply your new migration:

    flask db migrate -m "Your changes"
    flask db upgrade
    flask db-reset

The validation is ran per-PR and is required to merge. Build validation is also completed after.

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •