Skip to content
Portal for UGAHacks 5, University of Georgia's premier hackathon.
Python HTML CSS JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Made front end compatibility tweaks and renamed + rearranged folders. Jul 5, 2019
app Merge branch 'master' into BugFixes Dec 7, 2019
applications Fixed validation for mentor, volunteer, and uniemail fields. Also cha… Dec 3, 2019
baggage Included migrations Jul 15, 2019
checkin Included migrations Jul 15, 2019
files added dashboard view Jul 11, 2019
fixtures added dashboard view Jul 11, 2019
judging Removed Judging and Baggage from installed apps Dec 1, 2019
meals Revert "Merge branch 'master' of https://github.com/ugahacks/ugahacks5" Oct 30, 2019
organizers Added participant to search filter Dec 3, 2019
reimbursement Added blank=True Dec 2, 2019
stats
teams Included migrations Jul 15, 2019
user Change Name field limit to 25 Nov 30, 2019
workshops Added workshop to apps in settings and added workshop url. Also fixed… Nov 24, 2019
.editorconfig added dashboard view Jul 11, 2019
.flake8 added dashboard view Jul 11, 2019
.gitignore
.travis.yml added dashboard view Jul 11, 2019
LICENSE added dashboard view Jul 11, 2019
README.md added dashboard view Jul 11, 2019
USER_GUIDE.md added dashboard view Jul 11, 2019
app.json added dashboard view Jul 11, 2019
lib64 Added workshop to apps in settings and added workshop url. Also fixed… Nov 24, 2019
logo.png added dashboard view Jul 11, 2019
manage.py added dashboard view Jul 11, 2019
management.sh.template added dashboard view Jul 11, 2019
requirements.txt Updated requirements.txt Nov 24, 2019
restart.sh.template added dashboard view Jul 11, 2019
server.sh.template added dashboard view Jul 11, 2019

README.md

UGAHacks 5

Setup

Needs: Python 3, virtualenv

  • git clone https://github.com/ugahacks/ugahacks5 && cd ugahacks5
  • python3 -m venv venv
  • source ./venv/bin/activate
  • pip install -r requirements.txt
  • (Important) If setting up on the productions server, set up the Postgres environment variables before the next steps
  • python manage.py migrate
  • python manage.py createsuperuser (creates an admin account which you use to access... the admin panel, duh)

Running The App

Local

  • Set up (see above)
  • python manage.py runserver
  • Easy peasy, no more pesky docker

Production

Setup based on this tutorial. Read it if you run into any problems.

  • Set up (see above)
  • Create server.sh from template: cp server.sh.template server.sh
  • chmod +x server.sh
  • Edit settings variables to match your environment
  • Create restart.sh from template: cp restart.sh.template restart.sh
  • chmod +x restart.sh
  • Edit settings variables to match your environment
  • Run restart.sh. This will update the database, dependecies and static files.
  • Set up Systemd (read next section)

Setting Up Gunicorn

Needs: Systemd.

  • Enter sudo nano /etc/systemd/system/backend.service (yes I use nano, fight me)
  • Copy and paste the following:
[Unit]
Description=backend daemon
After=network.target

[Service]
User=user
Group=www-data
WorkingDirectory=/home/ugahacks/ugahacks5
ExecStart=/home/ugahacks/ugahacks5/server.sh >>/home/ugahacks/ugahacks5/out.log 2>>/home/ugahacks/ugahacks5/error.log

[Install]
WantedBy=multi-user.target
  • Create and enable service: sudo systemctl start backend && sudo systemctl enable backend

Setting Up Postgres

Needs: PostgreSQL installed

  • Enter PSQL console: sudo -u postgres psql
  • Create database: CREATE DATABASE backend;
  • Create user for database: CREATE USER backenduser WITH PASSWORD 'password'; (make sure to include a strong password)
  • Prepare a user for Django
ALTER ROLE backenduser SET client_encoding TO 'utf8';
ALTER ROLE backenduser SET default_transaction_isolation TO 'read committed';
ALTER ROLE backenduser SET timezone TO 'EST';
  • Grant all priviledges to your user for the created database: GRANT ALL PRIVILEGES ON DATABASE myproject TO myprojectuser;
  • Exit PSQL console: \q

Setting Up Nginx

Needs: Nginx

  • sudo nano /etc/nginx/sites-available/default
  • Add site:
server {
    listen 80;
    listen [::]:80;

    server_name my.ugahacks.com ugahacks.com;


    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        alias /home/ugahacks/ugahacks5/staticfiles/;
    }

    location /files/ {
        alias /home/ugahacks/ugahacks5/files/;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/ugahacks/ugahacks5/backend.sock;
        client_max_body_size 5MB;
    }


}

Deploying New Versions

  • git pull
  • ./restart.sh
  • sudo service backend restart

Management

Automated Expiration

  • Create management.sh from template: cp management.sh.template management.sh
  • chmod +x management.sh
  • Edit settings variables to match your environment
  • Add to crontab: crontab -e
*/5 * * * * cd /home/ugahacks/ugahacks5/ && ./management.sh > /home/ugahacks/ugahacks5/management.log 2> /home/ugahacks/ugahacks5/management_err.log

User Roles

  • is_volunteer: Allows user to check-in hackers with QR and list view
  • is_organizer: Allows user to vote, see voting ranking and check-in hackers.
  • is_director: Allows user to send invites to hackers as well as send reimbursement.
  • is_admin: Allows user to enter Django Admin interface

Important SQL Queries

Here are several queries that may be useful during the hackathon application process.

  1. source ./env/bin/activate
  2. python manage.py dbshell
  3. Run SQL query
  4. Extract results

Missing Applications Emails

Emails from users that have registered but have not completed the application.

SELECT u.email
FROM user_user u
WHERE NOT is_director AND NOT is_volunteer AND NOT is_organizer
AND u.id NOT IN
(SELECT a.user_id FROM applications_application a);

Personalization

Style

Content

Updating Email Templates:

You can update emails related to

Updating Hackathon Variables

Check all available variables at app/hackathon_variables.py.template. You can set the ones that you prefer at app/hackathon_variables.py

Updating Registration Form

You can change the form, titles, texts in applications/forms.py

Updating Application Model

If you need to add extra labels, you can change the model and add additions fields.

  • Update model with specific fields: applications/models.py
  • python manage.py makemigrations
  • python manage.py migrate

License

MIT © UGAHacks

You can’t perform that action at this time.