Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/odiroot/jiaoge

Keeping track of postcards if you're into it
https://github.com/odiroot/jiaoge

django heroku postcard postgresql s3 travel

Last synced: 23 days ago
JSON representation

Keeping track of postcards if you're into it

Awesome Lists containing this project

README

        

# jiaoge
_Keeping track of postcards if you're into it_

![https://www.flickr.com/photos/postmark_china/7751502180/](./postcard.jpg)

# Quickstart

## Requirements

* _Heroku_ account (free tier is good as well).
* _Amazon Web Services_ account (free tier works here too).
* _S3_ bucket, not exposed to the public by default.
* _IAM_ credentials for non-root user.

## Setup

1. Create a new application on Heroku, use the newest stack (`heroku-18`).
2. Add _Heroku Postgres_ add-on (_Hobby Dev_ suffices).
3. Add _Sentry_ add-on if you want to track errors.
4. Add `heroku/python` buildpack.
5. Add `heroku-community/apt` buildpack.
6. Connect your (clone of this one) _Github_ repository to your Heroku app.
7. Set the _Config Vars_.
* `ADMIN_URL` -- generate some hard to guess string in a form of `foo/`.
* `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` -- your IAM credentials.
* `AWS_STORAGE_BUCKET_NAME` -- name of your S3 bucket.
* `HASHID_FIELD_SALT` -- generate another hard to guess long string.
* `HEROKU_DOMAIN` -- the domain you access the app at. e.g.: `myproject.herokuapp.com`.

## First run
1. Use the _Manual deploy_ feature on Heroku to deploy `master` branch.
2. Wait until the deployment is done.
3. Select a _Free_ dyno tier for the `web` dyno.
4. Enable the `web` dyno to start it.
5. Spawn a shell session for the app: `heroku run -a bash`
6. Push the static files to S3: `./manage.py collectstatic`.

# Why
I personally send a lot of postcards to my family and friends whenever I'm
traveling.

One day it hit me -- it would be really nice to keep track _which_ postcard
did I send to _whom_ from _where_. On top of that, if only I could tell
how long have the postcards spent in transit?

I built this project as minimal, simple way to make this happen.

The whole application can be easily deployed on free _Heroku_ tier.
It relies on PostgreSQL instance being running and attached to the app.

# What
This is a very basic Django-based web application with barely any front-end
code, mostly leveraging the awesome Django Admin system.

_Normalize_ and _Milligram_ CSS framework are used to make the few
server-rendered views to look semi-decent on both desktop and mobile devices.

There's absolutely no JavaScript code involved.

# How
One can use the admin pages to create a simple "address book" (actually more
of a _rolodex_ as I wanted to avoid storing addresses) of friends and family
members.

As a second step it's possible to create records for the postcards to be sent
from one's travels. A card record is very rudimentary and consists of
the postcard source (where was it posted), destination (selected contact
from the address book) and dispatch date.

An extra feature allows user to upload a picture of the postcard to be attached
to the card record.

In a basic form the application user can also edit the card records to append
the information about the time of postcard reception.

# Bonus: interactivity
The cherry on top is the ability for the postcard receivers to confirm
their arrival (claim the card).

There's a card claim view: `/claim/` that can be used by the addressee
to let the sender know about the reception with a single press of a button.
Naturally, this relies on your friends/family being bothered enough to actually
open the claiming URL.

You can write/print the URL on your postcards to let the addressees enter
the claim page. I personally use _TinyURL_ to shorten the long Heroku address.

I also researched and opted for standard-format (48.5mm × 16.9mm) stickers
with pre-printed shortened claim URL, to which I add (by hand) the card
claim code (generated by the great _hashids_ library).
Every postcard has an unique claim address and can only be claimed once
(naturally). Finally I let the received give me a comment/feedback before
clicking the button.