bornhack-website/README.md

142 lines
4.9 KiB
Markdown
Raw Normal View History

2015-10-03 01:07:05 +00:00
# Bornhack
2019-03-29 20:00:34 +00:00
[![Build Status](https://travis-ci.org/bornhack/bornhack-website.svg?branch=master)](https://travis-ci.org/bornhack/bornhack-website)
[![codecov](https://codecov.io/gh/bornhack/bornhack-website/branch/master/graph/badge.svg)](https://codecov.io/gh/bornhack/bornhack-website)
Django project to power Bornhack. Features include news, villages, webshop, and more.
2015-10-03 01:07:05 +00:00
## Development setup
2015-10-03 01:07:05 +00:00
### Clone the repo
Clone with --recursive to include submodules:
git clone --recursive https://github.com/bornhack/bornhack-website
If you already cloned the repository without --recursive, you can change into the directory and add the submodules with:
git submodule update --init --recursive
### Virtualenv
SpeakerAvailability, EventSession, autoscheduler, and other goodies (#497) * fix old bug where the get_days() method would return the wrong number of days, this was not discovered because our bootstrap script has been creating 9 day camps instead of 8 day camps (this has been fixed in a different commit) * remove stray debug print * output camp days in local timezone (CEST usually), not UTC * speakeravailability commit of doom, originally intended for #385 but goes a bit further than that. Adds SpeakerAvailability and EventSession models, and models for the new autoscheduler. Update bootstrap script and more. New conference_autoscheduler dependency. Work in progress, but ready for playing around! * add conference-scheduler to requirements * rework migrations, work at bit with postgres range fields and bounds, change how speakeravailability is saved (continuous ranges instead of 1 hour chunks), add tests for utils/range_fields.py including adding hypothesis to requirements/dev.txt, add a test which runs our bootstrap script * catch name collision in the right place, and load missing postgres extension in the migration * add some verbosity to see what the travis issue might be * manually create btree_gist extension in postgres, not sure why the BtreeGistExtension() operation in program/migrations/0085... isn't working in travis? * create extension in the right database maybe * lets try this then * ok so the problem is not that the btree_gist extension isn't getting loaded, the problem is that GIST indexes do not work with uuid fields in postgres 9.6, lets take another stab at getting pg10 with postgis to work with in travis * lets try normal socket connection * add SPEAKER_AVAILABILITY_DAYCHUNK_HOURS=3 to travis environment_settings.py * rework migrations, change so an autoschedule can work with multiple eventtypes, change AutoSlot model to use a DateTimeRangeField so we can use the database for more efficient lookups, add 'conflicts' self m2m for EventLocation to indicate when a room conflicts with another room, add a support_autoscheduling bool to EventType, add workshops to bootstrap script, add timing output to bootstrap script * update README a bit, move some functionality to model methods, update jquery and jquery.datatables, include datatables in base.html instead of in each page, start adding backoffice schedule management views (unfinished), yolo commit so I can show valberg something * Switch to a more simple way of using the autoscheduler, meaning we can remove the whole autoscheduler app and all models. All autoscheduler code is now in program/autoscheduler.py and a bit in backoffice views. Add more backoffice CRUD views for schedule management. Add datatables moment.js plugin to help table sorting of dates. Add Speaker{Proposal}EventConflict model to allow speakers to inform us which events they want to attend so we dont schedule them at the same time. Add EventTag model. New models not hooked up to anything yet. * handle cases where there is no solution without failing, also dont return anything here * wrong block kiddo * switch from EventInstance to EventSlot as the way we schedule events. Finish backoffice content team views (mostly). Many small changes. Prod will need data migration of EventInstances -> EventSlots when the time comes. * keep speakeravailability stuff a bit more DRY by using the AvailabilityMatrixViewMixin everywhere, add event_duration_minutes to EventSession create/update form, reverse the order we delete/create EventSlot objects when updating an EventSession * go through all views, fix various little bugs here and there * add missing migration * add django-taggit, add tags for Events, add tags in bootstrap script, make AutoScheduler use tags. Add tags in forms and templates. * fix taggit entry in requirements * Fix our iCal view: Add uuid field to Event, add uuid property to EventSlot which calculates a consitent UUID for an event at a start time at a location. Use this as the schedule uuid. While here fix so our iCal export is valid, a few fields were missing, the iCal file now validates 100% OK. * fix our FRAB xml export view * comment the EventSlot.uuid property better * typo in comment * language Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * language Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * Update src/backoffice/templates/autoschedule_debug_events.html Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * add a field to make this form look less weird. No difference in functionality. * remove stray print and refactor this form init a bit * fix ScheduleView * only show slots where all speakers are available when scheduling events manually in backoffice * make event list sortable by video recording column * update description on {speaker|event}proposal models reason field * remove badge showing number of scheduled slots for each event in backoffice eventlist. it was unclear what the number meant and it doesn't really fit * remember to consider events in the same location when deciding whether a slot is available or not * add is_available() method to EventLocation, add clean_location() method to EventSlot, call it from EventSlot.clean(), update a bit of text in eventslotunschedule template * fix EventSession.get_available_slots() so it doesnt return busy slots as available, and since this means we can no longer schedule stuff in the lunchbreak lower the number of talks in the bootstrap script a bit so we have a better chance of having a solvable problem * fix the excludefilter in EventSession.get_available_slots() for real this time, also fix an icon and add link in event schedule template in backoffice * show message when no slots are available for manual scheduling in backoffice * add event_conflicts to SpeakerUpdateView form in backoffice * fix link to speaker object in speakerproposal list in backoffice * allow blank tags * make duration validation depend on the eventtype event_duration_minutes if we have one. fix help_text and label and placeholder for all duration fields * allow music acts up to 180 mins in the bootstrap data * fix wrong eventtype name for recreational events in speakerproposalform * stretch the colspan one cell more * save event_conflicts m2m when submitting speaker and event together * form not self, and add succes message * move js function toggleclass() to bornhack.js and rename to toggle_sa_form_class(), function is used in several templates and was missing when submitting combined proposals * move the no-js removal to the top of ready() function This will allow other javascript initialization (eg. DataTable) to see the elements and initialize accordingly (eg. column width for tables) * Fixed problem with event feedback detail view * Fixed problem with event feedback list view * introduce a get_tzrange_days() function and use that to get the relevant days for the matrix instead of camp.get_days(), thereby fixing some display issues when eventsessions cross dates * show submitting user and link to proposal on backoffice event detail page, change User to Submitter in backoffice speaker list table * show warning by the buttons when a proposal cannot be approved, and show better text on approve/reject buttons * disable js schedule, save m2m, prefetch some stuff * fix broken date header in table * remove use of djangos regular slugify function, use the new utils.slugs.unique_slugify() instead Co-authored-by: Thomas Steen Rasmussen <tykling@bornhack.org> Co-authored-by: Benjamin Balder Bach <benjamin@overtag.dk> Co-authored-by: Thomas Flummer <tf@flummer.net>
2020-06-03 19:18:06 +00:00
Create a Python 3.7 virtual environment and activate it:
2017-01-20 16:47:10 +00:00
```
SpeakerAvailability, EventSession, autoscheduler, and other goodies (#497) * fix old bug where the get_days() method would return the wrong number of days, this was not discovered because our bootstrap script has been creating 9 day camps instead of 8 day camps (this has been fixed in a different commit) * remove stray debug print * output camp days in local timezone (CEST usually), not UTC * speakeravailability commit of doom, originally intended for #385 but goes a bit further than that. Adds SpeakerAvailability and EventSession models, and models for the new autoscheduler. Update bootstrap script and more. New conference_autoscheduler dependency. Work in progress, but ready for playing around! * add conference-scheduler to requirements * rework migrations, work at bit with postgres range fields and bounds, change how speakeravailability is saved (continuous ranges instead of 1 hour chunks), add tests for utils/range_fields.py including adding hypothesis to requirements/dev.txt, add a test which runs our bootstrap script * catch name collision in the right place, and load missing postgres extension in the migration * add some verbosity to see what the travis issue might be * manually create btree_gist extension in postgres, not sure why the BtreeGistExtension() operation in program/migrations/0085... isn't working in travis? * create extension in the right database maybe * lets try this then * ok so the problem is not that the btree_gist extension isn't getting loaded, the problem is that GIST indexes do not work with uuid fields in postgres 9.6, lets take another stab at getting pg10 with postgis to work with in travis * lets try normal socket connection * add SPEAKER_AVAILABILITY_DAYCHUNK_HOURS=3 to travis environment_settings.py * rework migrations, change so an autoschedule can work with multiple eventtypes, change AutoSlot model to use a DateTimeRangeField so we can use the database for more efficient lookups, add 'conflicts' self m2m for EventLocation to indicate when a room conflicts with another room, add a support_autoscheduling bool to EventType, add workshops to bootstrap script, add timing output to bootstrap script * update README a bit, move some functionality to model methods, update jquery and jquery.datatables, include datatables in base.html instead of in each page, start adding backoffice schedule management views (unfinished), yolo commit so I can show valberg something * Switch to a more simple way of using the autoscheduler, meaning we can remove the whole autoscheduler app and all models. All autoscheduler code is now in program/autoscheduler.py and a bit in backoffice views. Add more backoffice CRUD views for schedule management. Add datatables moment.js plugin to help table sorting of dates. Add Speaker{Proposal}EventConflict model to allow speakers to inform us which events they want to attend so we dont schedule them at the same time. Add EventTag model. New models not hooked up to anything yet. * handle cases where there is no solution without failing, also dont return anything here * wrong block kiddo * switch from EventInstance to EventSlot as the way we schedule events. Finish backoffice content team views (mostly). Many small changes. Prod will need data migration of EventInstances -> EventSlots when the time comes. * keep speakeravailability stuff a bit more DRY by using the AvailabilityMatrixViewMixin everywhere, add event_duration_minutes to EventSession create/update form, reverse the order we delete/create EventSlot objects when updating an EventSession * go through all views, fix various little bugs here and there * add missing migration * add django-taggit, add tags for Events, add tags in bootstrap script, make AutoScheduler use tags. Add tags in forms and templates. * fix taggit entry in requirements * Fix our iCal view: Add uuid field to Event, add uuid property to EventSlot which calculates a consitent UUID for an event at a start time at a location. Use this as the schedule uuid. While here fix so our iCal export is valid, a few fields were missing, the iCal file now validates 100% OK. * fix our FRAB xml export view * comment the EventSlot.uuid property better * typo in comment * language Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * language Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * Update src/backoffice/templates/autoschedule_debug_events.html Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * add a field to make this form look less weird. No difference in functionality. * remove stray print and refactor this form init a bit * fix ScheduleView * only show slots where all speakers are available when scheduling events manually in backoffice * make event list sortable by video recording column * update description on {speaker|event}proposal models reason field * remove badge showing number of scheduled slots for each event in backoffice eventlist. it was unclear what the number meant and it doesn't really fit * remember to consider events in the same location when deciding whether a slot is available or not * add is_available() method to EventLocation, add clean_location() method to EventSlot, call it from EventSlot.clean(), update a bit of text in eventslotunschedule template * fix EventSession.get_available_slots() so it doesnt return busy slots as available, and since this means we can no longer schedule stuff in the lunchbreak lower the number of talks in the bootstrap script a bit so we have a better chance of having a solvable problem * fix the excludefilter in EventSession.get_available_slots() for real this time, also fix an icon and add link in event schedule template in backoffice * show message when no slots are available for manual scheduling in backoffice * add event_conflicts to SpeakerUpdateView form in backoffice * fix link to speaker object in speakerproposal list in backoffice * allow blank tags * make duration validation depend on the eventtype event_duration_minutes if we have one. fix help_text and label and placeholder for all duration fields * allow music acts up to 180 mins in the bootstrap data * fix wrong eventtype name for recreational events in speakerproposalform * stretch the colspan one cell more * save event_conflicts m2m when submitting speaker and event together * form not self, and add succes message * move js function toggleclass() to bornhack.js and rename to toggle_sa_form_class(), function is used in several templates and was missing when submitting combined proposals * move the no-js removal to the top of ready() function This will allow other javascript initialization (eg. DataTable) to see the elements and initialize accordingly (eg. column width for tables) * Fixed problem with event feedback detail view * Fixed problem with event feedback list view * introduce a get_tzrange_days() function and use that to get the relevant days for the matrix instead of camp.get_days(), thereby fixing some display issues when eventsessions cross dates * show submitting user and link to proposal on backoffice event detail page, change User to Submitter in backoffice speaker list table * show warning by the buttons when a proposal cannot be approved, and show better text on approve/reject buttons * disable js schedule, save m2m, prefetch some stuff * fix broken date header in table * remove use of djangos regular slugify function, use the new utils.slugs.unique_slugify() instead Co-authored-by: Thomas Steen Rasmussen <tykling@bornhack.org> Co-authored-by: Benjamin Balder Bach <benjamin@overtag.dk> Co-authored-by: Thomas Flummer <tf@flummer.net>
2020-06-03 19:18:06 +00:00
$ virtualenv venv -p python3.7
2017-01-20 16:47:10 +00:00
$ source venv/bin/activate
```
2016-07-03 12:27:31 +00:00
2020-06-19 04:25:55 +00:00
If you installed python3 using Homebrew on macOS, you will need to install virtualenv by running the following command first:
```
pip3 install virtualenv
```
### System libraries
Install system dependencies (method depends on OS):
2017-01-28 16:06:46 +00:00
- postgresql headers (for psycopg2):
- Debian: libpq-dev
2020-06-19 04:25:55 +00:00
- FreeBSD: databases/postgresql11-client
- macOS: If using the PostgreSQL.app, the headers are included, only path needs to be added
- libjpeg (for pdf generation)
2017-01-20 16:47:10 +00:00
- Debian: libjpeg-dev
2017-01-31 17:52:40 +00:00
- FreeBSD: graphics/jpeg-turbo
- macOS: brew install libjpeg
- libmagic (might already be installed)
- macOS: brew install libmagic
- wkhtmltopdf (also for pdf generation):
- Debian: wkhtmltopdf
- FreeBSD: converters/wkhtmltopdf
- macOS: install from https://wkhtmltopdf.org/
2017-03-30 07:36:29 +00:00
- fonts
- Debian: ?
- FreeBSD: x11-fonts/webfonts
- macOS: ?
2016-07-03 12:27:31 +00:00
### Python packages
2017-01-20 16:47:10 +00:00
Install pip packages:
```
(venv) $ pip install -r src/requirements/dev.txt
2017-01-20 16:47:10 +00:00
```
2016-07-03 12:27:31 +00:00
### Postgres
SpeakerAvailability, EventSession, autoscheduler, and other goodies (#497) * fix old bug where the get_days() method would return the wrong number of days, this was not discovered because our bootstrap script has been creating 9 day camps instead of 8 day camps (this has been fixed in a different commit) * remove stray debug print * output camp days in local timezone (CEST usually), not UTC * speakeravailability commit of doom, originally intended for #385 but goes a bit further than that. Adds SpeakerAvailability and EventSession models, and models for the new autoscheduler. Update bootstrap script and more. New conference_autoscheduler dependency. Work in progress, but ready for playing around! * add conference-scheduler to requirements * rework migrations, work at bit with postgres range fields and bounds, change how speakeravailability is saved (continuous ranges instead of 1 hour chunks), add tests for utils/range_fields.py including adding hypothesis to requirements/dev.txt, add a test which runs our bootstrap script * catch name collision in the right place, and load missing postgres extension in the migration * add some verbosity to see what the travis issue might be * manually create btree_gist extension in postgres, not sure why the BtreeGistExtension() operation in program/migrations/0085... isn't working in travis? * create extension in the right database maybe * lets try this then * ok so the problem is not that the btree_gist extension isn't getting loaded, the problem is that GIST indexes do not work with uuid fields in postgres 9.6, lets take another stab at getting pg10 with postgis to work with in travis * lets try normal socket connection * add SPEAKER_AVAILABILITY_DAYCHUNK_HOURS=3 to travis environment_settings.py * rework migrations, change so an autoschedule can work with multiple eventtypes, change AutoSlot model to use a DateTimeRangeField so we can use the database for more efficient lookups, add 'conflicts' self m2m for EventLocation to indicate when a room conflicts with another room, add a support_autoscheduling bool to EventType, add workshops to bootstrap script, add timing output to bootstrap script * update README a bit, move some functionality to model methods, update jquery and jquery.datatables, include datatables in base.html instead of in each page, start adding backoffice schedule management views (unfinished), yolo commit so I can show valberg something * Switch to a more simple way of using the autoscheduler, meaning we can remove the whole autoscheduler app and all models. All autoscheduler code is now in program/autoscheduler.py and a bit in backoffice views. Add more backoffice CRUD views for schedule management. Add datatables moment.js plugin to help table sorting of dates. Add Speaker{Proposal}EventConflict model to allow speakers to inform us which events they want to attend so we dont schedule them at the same time. Add EventTag model. New models not hooked up to anything yet. * handle cases where there is no solution without failing, also dont return anything here * wrong block kiddo * switch from EventInstance to EventSlot as the way we schedule events. Finish backoffice content team views (mostly). Many small changes. Prod will need data migration of EventInstances -> EventSlots when the time comes. * keep speakeravailability stuff a bit more DRY by using the AvailabilityMatrixViewMixin everywhere, add event_duration_minutes to EventSession create/update form, reverse the order we delete/create EventSlot objects when updating an EventSession * go through all views, fix various little bugs here and there * add missing migration * add django-taggit, add tags for Events, add tags in bootstrap script, make AutoScheduler use tags. Add tags in forms and templates. * fix taggit entry in requirements * Fix our iCal view: Add uuid field to Event, add uuid property to EventSlot which calculates a consitent UUID for an event at a start time at a location. Use this as the schedule uuid. While here fix so our iCal export is valid, a few fields were missing, the iCal file now validates 100% OK. * fix our FRAB xml export view * comment the EventSlot.uuid property better * typo in comment * language Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * language Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * Update src/backoffice/templates/autoschedule_debug_events.html Co-Authored-By: Benjamin Balder Bach <benjamin@overtag.dk> * add a field to make this form look less weird. No difference in functionality. * remove stray print and refactor this form init a bit * fix ScheduleView * only show slots where all speakers are available when scheduling events manually in backoffice * make event list sortable by video recording column * update description on {speaker|event}proposal models reason field * remove badge showing number of scheduled slots for each event in backoffice eventlist. it was unclear what the number meant and it doesn't really fit * remember to consider events in the same location when deciding whether a slot is available or not * add is_available() method to EventLocation, add clean_location() method to EventSlot, call it from EventSlot.clean(), update a bit of text in eventslotunschedule template * fix EventSession.get_available_slots() so it doesnt return busy slots as available, and since this means we can no longer schedule stuff in the lunchbreak lower the number of talks in the bootstrap script a bit so we have a better chance of having a solvable problem * fix the excludefilter in EventSession.get_available_slots() for real this time, also fix an icon and add link in event schedule template in backoffice * show message when no slots are available for manual scheduling in backoffice * add event_conflicts to SpeakerUpdateView form in backoffice * fix link to speaker object in speakerproposal list in backoffice * allow blank tags * make duration validation depend on the eventtype event_duration_minutes if we have one. fix help_text and label and placeholder for all duration fields * allow music acts up to 180 mins in the bootstrap data * fix wrong eventtype name for recreational events in speakerproposalform * stretch the colspan one cell more * save event_conflicts m2m when submitting speaker and event together * form not self, and add succes message * move js function toggleclass() to bornhack.js and rename to toggle_sa_form_class(), function is used in several templates and was missing when submitting combined proposals * move the no-js removal to the top of ready() function This will allow other javascript initialization (eg. DataTable) to see the elements and initialize accordingly (eg. column width for tables) * Fixed problem with event feedback detail view * Fixed problem with event feedback list view * introduce a get_tzrange_days() function and use that to get the relevant days for the matrix instead of camp.get_days(), thereby fixing some display issues when eventsessions cross dates * show submitting user and link to proposal on backoffice event detail page, change User to Submitter in backoffice speaker list table * show warning by the buttons when a proposal cannot be approved, and show better text on approve/reject buttons * disable js schedule, save m2m, prefetch some stuff * fix broken date header in table * remove use of djangos regular slugify function, use the new utils.slugs.unique_slugify() instead Co-authored-by: Thomas Steen Rasmussen <tykling@bornhack.org> Co-authored-by: Benjamin Balder Bach <benjamin@overtag.dk> Co-authored-by: Thomas Flummer <tf@flummer.net>
2020-06-03 19:18:06 +00:00
You need to have a running Postgres instance (sqlite or mysql or others can't be used, because we use Postgres-specific fields and PostGIS/GeoDjango). Install Postgres and PostGIS, and add a database `bornhack` (or whichever you like) with some way for the application to connect to it, for instance adding a user with a password. Connect to the database as a superuser and run `create extension postgis`. The postgres version in production is 12 and the postgis version in production is 2.5. The minimum postgres version is 10, because we use GIST indexes on uuid fields (for ExclusionConstraints).
### Configuration file
Copy dev environment settings file and change settings as needed:
2017-01-20 16:47:10 +00:00
```
(venv) $ cp src/bornhack/environment_settings.py.dist.dev src/bornhack/environment_settings.py
2017-01-20 16:47:10 +00:00
```
2016-07-03 12:27:31 +00:00
Edit the configuration file, setting up `DATABASES` matching your Postgres settings.
2017-08-28 19:28:27 +00:00
### Database
Is this a new installation? Initialize the database:
2017-01-20 16:47:10 +00:00
```
(venv) $ python src/manage.py migrate
2017-01-20 16:47:10 +00:00
```
Is this for local development? Bootstrap the database with dummy data and users:
2017-01-20 16:47:10 +00:00
```
(venv) $ python src/manage.py bootstrap_devsite
2017-01-20 16:47:10 +00:00
```
2017-08-28 20:29:38 +00:00
### Done
2017-08-28 20:29:38 +00:00
Is this for local development? Start the Django devserver:
```
(venv) $ python src/manage.py runserver
2017-08-28 20:29:38 +00:00
```
Otherwise start uwsgi or similar to serve the application.
Enjoy!
## Notes
### Running tests
If your database user in your dev setup is not a postgres superuser you will encounter permission errors when the migrations try to create extensions "btree_gist" and "postgis". You can solve this by connecting to the "template1" database as the postgres superuser and creating the extensions there, which means they will be automatically loaded for all newly created databases.
### Add a camp
Add a new camp by running:
```
(venv) $ python src/manage.py createcamp {camp-slug}
```
Then go to the admin interface to edit the camp details, adding the same slug
that you just used and some current dates.
You can also specify details like:
* A sponsors page, `{camp-slug}_sponsors.html`, to `sponsors/templates`.
* A frontpage, `{camp-slug}_camp_detail.html`, to `camps/templates`.
* A call for speakers page, `{camp-slug}_call_for_speakers.html`, to `program/templates`.
* A `static_src/img/{camp-slug}/logo` and add two logos:
* `{camp-slug}-logo-large.png`
* `{camp-slug}-logo-small.png`
## Contributors
2018-03-04 14:55:18 +00:00
* Alexander Færøy https://github.com/ahf
* Benjamin Bach https://github.com/benjaoming
* coral https://github.com/coral
2021-05-03 10:51:41 +00:00
* Flemming Jacobsen https://github.com/batmule
2018-03-04 14:55:18 +00:00
* Henrik Kramshøj https://github.com/kramse
* Janus Troelsen https://github.com/ysangkok
* Jeppe Ernst https://github.com/Ern-st
2018-03-04 14:55:18 +00:00
* Jonty Wareing https://github.com/Jonty
* Kasper Christensen https://github.com/fALKENdk
* klarstrup https://github.com/klarstrup
* kugg https://github.com/kugg
* lgandersen https://github.com/lgandersen
2018-03-04 14:55:18 +00:00
* RadicalPet https://github.com/RadicalPet
* Reynir Björnsson https://github.com/reynir
* Ronni Elken Lindsgaard https://github.com/rlindsgaard
* Stephan Telling https://github.com/Telling
* Thomas Flummer https://github.com/flummer
2018-03-04 14:55:18 +00:00
* Thomas Steen Rasmusssen https://github.com/tykling
* Víðir Valberg Guðmundsson https://github.com/valberg
* Ximin Luo https://github.com/infinity0