Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVELOP TO MASTER #287

Merged
merged 94 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
d6fc104
Update to python 3.9+ and fix vulnerabilities
Oct 14, 2023
b7d9f40
Removed phone, repeated funct, added discover,
EncryptEx Dec 30, 2023
79c11b0
fix travel
EncryptEx Dec 30, 2023
89e6514
Add env to gitignore
jmiarons Jan 4, 2024
3930749
Add dockerfile and docker compose
jmiarons Jan 4, 2024
32bd3d6
Add dockerignore file
jmiarons Jan 4, 2024
7d16406
Add template with necessary variables for docker
jmiarons Jan 4, 2024
6ae45e4
Add cronjob to use in docker
jmiarons Jan 4, 2024
8bf9ec5
Serve static files in production mode using whitenoise
jmiarons Jan 4, 2024
05298e2
Change env variables to connect to database
jmiarons Jan 4, 2024
ccdc08b
Fix vulnerabilities in dependencies
jmiarons Jan 4, 2024
d1af4d4
Add default env values
jmiarons Jan 4, 2024
3a2006a
translated (td: fix errors and validations)
aacraf Jan 10, 2024
0f863b7
works.td: test all cases
aacraf Jan 10, 2024
e8e0c3d
fix some validation error. td: translate templates?
aacraf Jan 11, 2024
5647d7f
Clean dockerfile + prepare to deploy
jmiarons Jan 11, 2024
662e469
merge changes
jmiarons Jan 19, 2024
8936416
Disable google wallet + add env
jmiarons Jan 19, 2024
e30ecd4
Updated stable version
EncryptEx Jan 19, 2024
10f5c69
Added migrations to graduation_year
EncryptEx Jan 19, 2024
a2448ac
Canvis mentors, falten probar
AdriMM26 Jan 22, 2024
c206459
Merge branch 'canvis_mentors' of https://github.com/hackupc/myhackupc…
aacraf Jan 23, 2024
c8b80ed
Remove hardware module dependency and git from docker
jmiarons Jan 23, 2024
b295aef
Merge
jmiarons Jan 23, 2024
09caf51
Canvis mentors
AdriMM26 Jan 23, 2024
770d9f1
errors ortografics. merci Adri :)
aacraf Jan 24, 2024
e398fd5
added local suggesitons
EncryptEx Jan 24, 2024
a0bdf5e
fix clean logic
EncryptEx Jan 24, 2024
621e0d7
fixed more errors. thanks Jaume :)
aacraf Jan 24, 2024
9abcda2
Merge pull request #266 from hackupc/canvis_mentors
AdriMM26 Jan 24, 2024
fa3bed8
Fix cron not starting properly
jmiarons Jan 24, 2024
ff8ac0f
Merge branch 'development' into canvis_volunteers
jmiarons Jan 24, 2024
cf62f5b
Merge pull request #265 from hackupc/canvis_volunteers
jmiarons Jan 24, 2024
6f63d99
Merge branch 'development' into FEAT/Add-where-did-you-met-us-field
jmiarons Jan 24, 2024
1a5c5b0
Merge pull request #269 from hackupc/FEAT/Add-where-did-you-met-us-field
jmiarons Jan 24, 2024
56ee61a
Merge branch 'development' into docker
jmiarons Jan 24, 2024
7a15d1b
Merge pull request #267 from hackupc/docker
jmiarons Jan 24, 2024
0ab2bf2
Change cronjob to absolute path
jmiarons Jan 24, 2024
7d2f5aa
Merge branch 'development' into docker
jmiarons Jan 24, 2024
bac90b4
Merge pull request #270 from hackupc/docker
jmiarons Jan 24, 2024
a014f27
Merge migrations
jmiarons Jan 24, 2024
65c5ea9
Fix migrations v2
jmiarons Jan 24, 2024
a0534f1
Update night_shift_question
AdriMM26 Jan 24, 2024
08f73d5
Removed travel
EncryptEx Jan 27, 2024
9671264
fixed other_gender clean
EncryptEx Jan 28, 2024
a79f8d1
Add python 3.10 template and remove old versions
jmiarons Jan 28, 2024
d23b924
Merge pull request #272 from hackupc/FIX/Remove-travel
EncryptEx Jan 28, 2024
7009778
Merge pull request #275 from hackupc/ci-update
jmiarons Jan 28, 2024
1446ba1
Fix cron (#274)
jmiarons Jan 28, 2024
84cc956
fix which_hack error
aacraf Jan 30, 2024
8ccda7f
Add 2023 edition+erase no pork diet (#273)
AdriMM26 Feb 2, 2024
ae246a4
Merge branch 'develop' into fix_which_hacj
jmiarons Feb 2, 2024
36a33a1
Merge pull request #277 from hackupc/fix_which_hacj
jmiarons Feb 2, 2024
3978788
Fix/mentor+change gradutation time line (#276)
AdriMM26 Feb 2, 2024
87cd6ec
Add migration file
jmiarons Feb 2, 2024
e5ae166
Merge pull request #280 from hackupc/migration-fix
jmiarons Feb 2, 2024
503f725
Added text to clarify how teams work
jmiarons Feb 4, 2024
9746976
Fix night shift voluntees
jmiarons Feb 4, 2024
284631b
Merge pull request #282 from hackupc/volunteers-night
AdriMM26 Feb 4, 2024
f483f0e
Merge branch 'develop' into teams-rules
AdriMM26 Feb 4, 2024
35b297e
Merge pull request #281 from hackupc/teams-rules
EncryptEx Feb 5, 2024
8797150
Add phone number to hacker
jmiarons Feb 5, 2024
848fd1b
other diets to Otras dietas
aacraf Feb 5, 2024
1dbc62a
Merge branch 'develop' of https://github.com/hackupc/myhackupc into d…
aacraf Feb 6, 2024
8895e05
texts, labels and under_age default option
aacraf Feb 6, 2024
cd9f375
Merge pull request #283 from hackupc/dietsandtext
jmiarons Feb 6, 2024
8646071
Add phone number helper to base
jmiarons Feb 6, 2024
4d7fddd
Added 2024 colors and background
gerardm27 Feb 9, 2024
b8335f6
Merge pull request #285 from hackupc/2024-styles
EncryptEx Feb 9, 2024
ac54b2d
Added workflow
EncryptEx Feb 9, 2024
6f2eca7
Merge branch 'develop' into hacker-phone
EncryptEx Feb 9, 2024
f239c18
Merge branch 'develop' into CD/Added-provisional-CD
EncryptEx Feb 9, 2024
a3b7e74
Merge pull request #286 from hackupc/CD/Added-provisional-CD
EncryptEx Feb 9, 2024
97db49b
Merge branch 'develop' into hacker-phone
AdriMM26 Feb 9, 2024
a3fa265
changed dates
EncryptEx Feb 10, 2024
4b0ddbf
Canvis applications hackers
AdriMM26 Feb 10, 2024
1e9e8ba
Recaptcha fallito tontorron
AdriMM26 Feb 10, 2024
c4f5a88
Fallito tontorron
AdriMM26 Feb 10, 2024
f449772
Fixed blank pdf view
AdriMM26 Feb 10, 2024
105949f
Delete app/hackathon_variables.py
AdriMM26 Feb 10, 2024
78de7da
Merge pull request #288 from hackupc/FIX/change-dates
gerardm27 Feb 10, 2024
74e5497
Added default option and fixed clean discover
EncryptEx Feb 11, 2024
1acd97b
Revert "Delete app/hackathon_variables.py"
EncryptEx Feb 11, 2024
a116607
revert hackathon_variables
EncryptEx Feb 11, 2024
9b0e2b8
add endline
EncryptEx Feb 11, 2024
4bcd757
Wip urlvalidator with custom msg
EncryptEx Feb 11, 2024
458d4d6
Merge pull request #290 from hackupc/FIX--add-default-optn-discover
gerardm27 Feb 12, 2024
f3dd243
Merge branch 'develop' into FIX/pdf_view
EncryptEx Feb 12, 2024
516d312
remove "Please" msg to unify media form error
EncryptEx Feb 14, 2024
f045b47
Merge pull request #289 from hackupc/FIX/pdf_view
EncryptEx Feb 14, 2024
41e7f80
Changed color to mails buttons and links [Missing 2024 Banner] (#291)
gerardm27 Feb 14, 2024
edc1227
Augment max login tries
EncryptEx Feb 15, 2024
af1b67f
Merge branch 'develop' into EncryptEx-patch-1
EncryptEx Feb 15, 2024
730f468
Merge pull request #292 from hackupc/EncryptEx-patch-1
AdriMM26 Feb 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ workflows:
version: 2
test:
jobs:
- build-3.7
- build-3.8
- build-3.9
- build-3.10

jobs:
build-3.7: &test-template
Expand Down Expand Up @@ -54,3 +52,7 @@ jobs:
<<: *test-template
docker:
- image: circleci/python:3.9
build-3.10:
<<: *test-template
docker:
- image: circleci/python:3.10
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
db.sqlite3
staticfiles
*.template
.env
env
.github
.circleci
tmp
19 changes: 19 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PROD_MODE="True"
SECRET=""
POSTGRES_DB="postgres"
POSTGRES_USER="postgres"
POSTGRES_PASSWORD="password"
POSTGRES_HOST="db"
SG_KEY=""
TP_KEY=""
DOMAIN=""
IP_SERVER=""
GOOGLE_RECAPTCHA_SECRET_KEY=""
GOOGLE_RECAPTCHA_SITE_KEY=""
CAS_SERVER=""
OIDC_DISCOVERY_ENDPOINT=""
POSTGRES_PORT="5432"
MYHACKUPC_PORT="8000"
GOOGLE_WALLET_ISSUER_ID=""
GOOGLE_WALLET_CLASS_SUFFIX=""
GOOGLE_WALLET_APPLICATION_CREDENTIALS="/path/to/credentials.json" # remember to allow read perms
23 changes: 23 additions & 0 deletions .github/workflows/backendTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy on BackendTest

on:
push:
branches:
- 'develop'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Git pull and rebuild docker
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSHKEY }}
script: ${{ secrets.SCRIPT }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ files/*
cache/
*.sh

.google-service.account.json
.env
.google-service.account.json
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM python:3.10-alpine

RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Upgrade pip before installing dependencies
RUN pip install --upgrade pip
COPY requirements.txt requirements.txt
# Add bin to path to avoid wanring
ENV PATH="/home/biene/.local/bin:${PATH}"
# Disable cache because it won't be used because it will be installed only when creating image
RUN pip install --no-cache-dir -r requirements.txt

# Mounts the application code to the image
COPY . code
WORKDIR /code

# Generate static files in the container
RUN python manage.py collectstatic --noinput

# Add crons from crontab django module to system cron
RUN python manage.py crontab add
21 changes: 2 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,16 @@

Needs: Python 3.X, virtualenv

Stable at v. 3.8.10
Stable at v. 3.10.X

- `git clone https://github.com/hackupc/myhackupc && cd myhackupc`
- `virtualenv env --python=python3`
- `virtualenv env --python=python3.10`
- `source ./env/bin/activate`
- `pip install -r requirements.txt`
- (Optional) If using Postgres, set up the necessary environment variables for its usage before this step
- `python manage.py migrate`
- `python manage.py createsuperuser` (creates super user to manage all the app)

### FAQ
**The library backports.zoneinfo fails to install**
If you are experiencing an error similar to this one:

``
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
``

Plase make sure to use *Python **3.8.10***


**The library Pillow fails to install**
Ths did the trick (note the python and -m flag are placed in purpouse to make sure you install it using the correct virtualenv python version):
```
python -m pip install --upgrade Pillow
```

### Dummy data

_Coming soon_
Expand Down
10 changes: 5 additions & 5 deletions app/hackathon_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Hackathon timezone
TIME_ZONE = 'CET'
# This description will be used on the html and sharing meta tags
HACKATHON_DESCRIPTION = 'Join us for BarcelonaTech\'s hackathon. 36h. May 12 - 14.'
HACKATHON_DESCRIPTION = 'Join us for BarcelonaTech\'s hackathon. 36h. May 3 - 5.'
# Domain where application is deployed, can be set by env variable
HACKATHON_DOMAIN = os.environ.get('DOMAIN', None)
HEROKU_APP_NAME = os.environ.get('HEROKU_APP_NAME', None)
Expand Down Expand Up @@ -40,11 +40,11 @@
HACKATHON_GITHUB_REPO = 'https://github.com/hackupc/myhackupc/'

# (OPTIONAL) Applications deadline
HACKATHON_APP_DEADLINE = timezone.datetime(2023, 5, 3, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
VOLUNTEER_APP_DEADLINE = timezone.datetime(2023, 5, 9, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
MENTOR_APP_DEADLINE = timezone.datetime(2023, 5, 1, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
HACKATHON_APP_DEADLINE = timezone.datetime(2024, 5, 3, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
VOLUNTEER_APP_DEADLINE = timezone.datetime(2024, 5, 9, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
MENTOR_APP_DEADLINE = timezone.datetime(2024, 5, 1, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
# (OPTIONAL) Online checkin activated
ONLINE_CHECKIN = timezone.datetime(2022, 4, 29, 17, 00, tzinfo=timezone.pytz.timezone(TIME_ZONE))
ONLINE_CHECKIN = timezone.datetime(2024, 4, 29, 17, 00, tzinfo=timezone.pytz.timezone(TIME_ZONE))
# (OPTIONAL) When to arrive at the hackathon
HACKATHON_ARRIVE = ''

Expand Down
2 changes: 1 addition & 1 deletion app/middlewares.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from backports import zoneinfo
import zoneinfo
from django.utils import timezone


Expand Down
31 changes: 20 additions & 11 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

# Application definition
INSTALLED_APPS = [
"whitenoise.runserver_nostatic",
'django_crontab',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
Expand Down Expand Up @@ -57,7 +59,7 @@
'corsheaders',
]

GOOGLE_WALLET_ENABLED=True #Set to false to disable google wallet
GOOGLE_WALLET_ENABLED = False # Set to false to disable google wallet

if BAGGAGE_ENABLED:
INSTALLED_APPS.append('baggage')
Expand All @@ -79,6 +81,7 @@
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
"corsheaders.middleware.CorsMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down Expand Up @@ -126,14 +129,14 @@
ssl_require=os.environ.get('DATABASE_SECURE', 'true').lower() != 'false',
)

if os.environ.get('PG_PWD', None):
if os.environ.get('POSTGRES_PASSWORD', None):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ.get('PG_NAME', 'backend'),
'USER': os.environ.get('PG_USER', 'backenduser'),
'PASSWORD': os.environ.get('PG_PWD'),
'HOST': os.environ.get('PG_HOST', 'localhost'),
'NAME': os.environ.get('POSTGRES_DB', 'backend'),
'USER': os.environ.get('POSTGRES_USER', 'backenduser'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
'HOST': os.environ.get('POSTGRES_HOST', 'localhost'),
'PORT': '5432',
}
}
Expand Down Expand Up @@ -191,14 +194,14 @@
STATICFILES_DIRS = [
os.path.join(BASE_DIR, os.path.join('app', "static")),
]
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

# Dev emails set up
if os.environ.get('ADMIN_EMAIL', None):
try:
HACKATHON_DEV_EMAILS.append(os.environ['ADMIN_EMAIL'])
except NameError:
HACKATHON_DEV_EMAILS = [os.environ['ADMIN_EMAIL'],]
HACKATHON_DEV_EMAILS = [os.environ['ADMIN_EMAIL'], ]

# File upload configuration
MEDIA_ROOT = 'files'
Expand Down Expand Up @@ -292,9 +295,9 @@
MAX_VOTES_TO_APP = 30

APPLICATION_EXPIRATION_TYPES = {
'H': True, # Hacker allways expire, do not change this
'M': MENTOR_EXPIRES, # Mentor can expire
'V': VOLUNTEER_EXPIRES, # Volunteer can expire
'H': True, # Hacker allways expire, do not change this
'M': MENTOR_EXPIRES, # Mentor can expire
'V': VOLUNTEER_EXPIRES, # Volunteer can expire
}

MEALS_TOKEN = os.environ.get('MEALS_TOKEN', None)
Expand Down Expand Up @@ -324,3 +327,9 @@
# Security
SESSION_COOKIE_SECURE = CSRF_COOKIE_SECURE = not DEBUG
SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin"

# Cron configuration to expire invitations and reimbursements
CRONJOBS = [
('6 */2 * * *', 'django.core.management.call_command', ['expire_reimbursements']),
('6 */2 * * *', 'django.core.management.call_command', ['expire_applications']),
]
Loading