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.
- 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
- Valid event prefixes include:
- First download the code from the repository
- Ensure both
clean.shandsetup.shhave execute permissions, you can do this withchmod u+x scriptname.sh - Run the
setup.shscript 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
Make sure your dependencies are installed:
./setup.sh
. venv/bin/activate
python -m pip install requirements.txtYou can validate data changes in the data/ directory by using the flask command:
python -m flask db-validateYou can regenerate the SQLite database with:
python -m flask db-resetWhen making changes to the database schema (models in db_schema.py):
-
Create a migration after modifying the models:
export FLASK_APP=codesoc.py flask db migrate -m "Description of your changes"
-
Apply the migration:
flask db upgrade
-
Reset database with new schema:
flask db-reset
If you encounter migration conflicts or "table already exists" errors:
-
Check current migration status:
flask db current
-
If database is inconsistent, stamp it as current:
flask db stamp head
-
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.