From d44eb22a62d5712c8e9c69261d401391605bb9a1 Mon Sep 17 00:00:00 2001 From: Ethan Zimbelman Date: Sat, 11 Jul 2020 17:29:38 -0500 Subject: [PATCH 1/4] year format fix --- directory/templates/intake.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory/templates/intake.html b/directory/templates/intake.html index a622978..2b3f723 100644 --- a/directory/templates/intake.html +++ b/directory/templates/intake.html @@ -54,7 +54,7 @@

Intake Form

- +
From 37d04ce9e355ffbca2f71a421e3afa922fc711c7 Mon Sep 17 00:00:00 2001 From: Ethan Zimbelman Date: Sat, 11 Jul 2020 17:54:38 -0500 Subject: [PATCH 2/4] re-add authentication --- backend/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/views.py b/backend/views.py index afdfc26..5ba66f0 100644 --- a/backend/views.py +++ b/backend/views.py @@ -17,7 +17,7 @@ class UserViewSet(viewsets.ModelViewSet): class CatViewSet(viewsets.ModelViewSet): queryset = Cat.objects.filter(hidden=False) serializer_class = CatSerializer - # permission_classes = [permissions.IsAuthenticated] + permission_classes = [permissions.IsAuthenticated] def get_queryset(self): queryset = Cat.objects.filter(hidden=False) From dd0cc1fbd1025cf4877f5829e66d69b299e9ede5 Mon Sep 17 00:00:00 2001 From: Ethan Zimbelman Date: Sat, 11 Jul 2020 19:54:08 -0500 Subject: [PATCH 3/4] s3 region config var created --- .defaultenv | 2 ++ backend/settings.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.defaultenv b/.defaultenv index 43d04e6..e3a7d78 100644 --- a/.defaultenv +++ b/.defaultenv @@ -4,6 +4,8 @@ SECRET_KEY='' # generate a key from https://djecrety.ir or equivalent DEBUG=True ISPROD=False +# only needed if ISPROD is True AWS_ACCESS_KEY_ID='' AWS_SECRET_ACCESS_KEY='' +AWS_S3_REGION_NAME='' S3_BUCKET_NAME='' diff --git a/backend/settings.py b/backend/settings.py index 83fc92b..e52adf1 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -144,7 +144,7 @@ DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' AWS_STORAGE_BUCKET_NAME = config('S3_BUCKET_NAME', default=os.environ.get('S3_BUCKET_NAME')) - AWS_S3_REGION_NAME = 'us-west-2' + AWS_S3_REGION_NAME = config('AWS_S3_REGION_NAME', default=os.environ.get('AWS_S3_REGION_NAME')) AWS_DEFAULT_ACL = None else: From 3092bf6b6d3988ad8e60ca2827529407940d88a9 Mon Sep 17 00:00:00 2001 From: Ethan Zimbelman Date: Sat, 11 Jul 2020 19:55:12 -0500 Subject: [PATCH 4/4] project, team, and development info added --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c3a3866..fc08180 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,42 @@ # Cal Poly Cat Program -### Cat Directory -The Cal Poly Cat Program cat directory made in Django. The mobile app repository can be found in [finlaylp/SLO_cat_shelter_mobile](https://github.com/finlaylp/SLO_cat_shelter_mobile). +### A cat directory made for the [Cal Poly Cat Program (CPCP)](https://catprogram.calpoly.edu/) + + + + + + +The [Cal Poly Cat Program (CPCP)](https://catprogram.calpoly.edu/) is a non-profit organization of students, faculty, staff and community members who care about the health and happiness of both feral and domesticated cats. This software was made to decrease logistical friction (they were using paper filing and a large excel sheet) so they could focus on helping the cats. This site is currently live [here](https://cpcp-cats.herokuapp.com/). + +There is also an accompanying mobile app for this site! The repository can be [found here](https://github.com/finlaylp/SLO_cat_shelter_mobile). + +## The Team +- Sydney Nguyen [@syddaddie](https://www.instagram.com/syddaddie/) - Designer +- Finlay Piroth [@finlaylp](https://github.com/finlaylp) - Mobile Developer +- Jillian Quinn [@JillianQuinn](https://github.com/JillianQuinn) - Mobile Developer +- Jay Sung [@jaysungl42](https://github.com/jaysungl42) - Frontend Developer +- Evan Witulski [@ewitulsk](https://github.com/ewitulsk) - Backend Developer +- Ethan Zimbelman [@Zimboboys](https://github.com/Zimboboys) - Team Lead / Full Stack Developer + +## Getting Started +The web portion of this application was made in Django. The following will assume you have Python, Django, and pip installed. + +1. Clone the repo `git clone https://github.com/hack4impact-calpoly/calpoly-cat-program` +2. Move into that directory `cd calpoly-cat-program` and install the dependancies `pip install -r requirements.txt` +3. Configure the environment variables in `.defaultenv` and rename it to `.env` +4. From the command line, run `python manage.py migrate`, then `python manage.py runserver` +5. Hopefully the site is up and you can visit it at [localhost:8000](http://localhost:8000) + +### Deployment +This site is deployed on Heroku, which is nice because it is free, but not nice because it [won't store files long term](https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted). To get around this, we use s3 for file storage. This should be fine because s3 is cheap. + +Note: Deploying with static files on Heroku is difficult. Keep the server in DEBUG=True mode to counter this + +To setup s3 file storage, do the following. This assumes you have an AWS account. + +1. Create an IAM user with the AmazonS3FullAccess policy attached +2. Copy these credentials into your `.env` +3. Create an S3 bucket and [enable CORS](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html#how-do-i-enable-cors) +4. Copy the bucket name to your `.env` file and change ISPROD to True +5. Start the web server