Skip to content

Commit

Permalink
Merge pull request #32 from Zimboboys/master
Browse files Browse the repository at this point in the history
posishes + readme updates
  • Loading branch information
zimeg authored Jul 12, 2020
2 parents 5c905cb + 3092bf6 commit dd05ad4
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .defaultenv
Original file line number Diff line number Diff line change
Expand Up @@ -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=''
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/)

<span>
<img src="https://user-images.githubusercontent.com/18134219/87235554-b068d500-c3a2-11ea-97f4-bd4939c150d6.png" width="48%" />
<img src="https://user-images.githubusercontent.com/18134219/87235553-ae9f1180-c3a2-11ea-87d1-f74858867a39.png" width="48%" />
</span>

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
2 changes: 1 addition & 1 deletion backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion backend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion directory/templates/intake.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h2>Intake Form</h2>
</div>
<div class="form-group required">
<label for="id_arrival_date">Arrival Date</label>
<input type="date" value="{{ cat.arrival_date|date:'yy-m-d' }}" class="form-control" name="arrival_date" id="id_arrival_date" required>
<input type="date" value="{{ cat.arrival_date|date:'Y-m-d' }}" class="form-control" name="arrival_date" id="id_arrival_date" required>
</div>
<div class="form-group required">
<label for="id_arrival_details">Arrival Details (reason coming to shelter)</label>
Expand Down

0 comments on commit dd05ad4

Please sign in to comment.