this is the website for the hack club layered YSWS!
so... you want to help develop the website? here's some detailed setup instructions
- run
git clone https://github.com/hellonearth311/layered.git - create a .env file with this template
HCA_CLIENT_ID = CLIENT_ID_GOES_HERE
HCA_CLIENT_SECRET = CLIENT_SECRET_GOES_HERE
HCA_CALLBACK_URI = http://localhost:8000/oauth/callback
SECRET_KEY=dev-secret-key
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
ALLOW_JOURNALING = True
POSTGRES_DB = django
POSTGRES_USER = django
POSTGRES_PASSWORD = django
POSTGRES_HOST = localhost
POSTGRES_PORT = 5432
SLACK_TOKEN = SLACK_TOKEN_GOES_HERE
DEFAULT_PFP = https://cdn.hackclub.com/019ee160-b8f6-7920-aca0-6e35fffc2b6a/slack_hash_256.png
CF_ACCOUNT_ID = CLOUDFLARE_ACCOUNT_ID_GOES_HERE
CLOUDFLARE_TOKEN = CLOUDFLARE_TOKEN_GOES_HERE
R2_ACCESS_KEY_ID = R2_ACCESS_KEY_ID_GOES_HERE
R2_SECRET_ACCESS_KEY = R2_SECRET_ACCESS_KEY_GOES_HERE
R2_BUCKET_NAME = R2_BUCKET_NAME_GOES_HERE
R2_PUBLIC_URL = R2_PUBLIC_URL_GOES_HERE
PRINTABLES_GRAPHQL_URL = https://api.printables.com/graphql/
this is for the HCA_CLIENT_ID, HCA_CLIENT_SECRET, and HCA_CALLBACK_URI fields! the process for getting these is quite simple, just:
- head over to hack club auth
- enable developer mode
- create a new app, call it whatever you want, and grab the client id and client secret
- change the redirect uri to
http://localhost:8000/oauth/callback...and that's it for auth!
i didn't know what to call this one, but all these values are fine. i'll still explain what they do because i'm kind.
SECRET_KEY: something django needs to work, in prod it has to be generated with a terminal command but in dev this is fineDEBUG: django debug mode, easier debugging w/ tracebacks. keep on unless testing production behavior.ALLOWED_HOSTS: allowed django hosts to run on.ALLOW_JOURNALING: allow users without the organizer permission to journal
all of this stuff also stays the same lol
leave DEFAULT_PFP the same. to get your SLACK_TOKEN:
- create an app on slack
- go to "OAuth and Permissions"
- go to bot token scopes and allow
users.profile:readandusers.read - install the app to hack club
- get your
xoxb-token!
while the R2 bucket that's used for object storage is free, to obtain one you need to provide them with a valid credit/debit card!
- get a cloudflare R2 bucket (i'm not explaining how to do this, google it! it's not too difficult but you will need a payment method.)
- head to your R2 dash and copy your user id
- click on "API tokens"
- create an account api token with access to your bucket
- get your token, access key id, and access key
- also get your bucket name and paste that in
- go inside your bucket
- head to settings
- enable public development URL
- grab the public developer URL and paste it in!
- run
python -m venv .venv - wait for vscode to detect the venv and activate it
- run
pip install -r requirements.txt - run
cd layered - run
python manage.py migrate - run
docker compose up db - open a new terminal tab and run
python manage.py runserver - head to
localhost:8000and enjoy
if you need any help with any of this setup, feel free to DM @swn on the Hack Club Slack or email me at swarit@shipwrights.dev