Skip to content

Commit

Permalink
Merge pull request #16 from p4kl0nc4t/p4kl0nc4t-heroku-depl
Browse files Browse the repository at this point in the history
Deploy Praesentia on Heroku
  • Loading branch information
ttycelery committed Jan 12, 2022
2 parents e5c6838 + 30a5ecd commit 397558e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn wsgi:app
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,38 @@ Praesentia is a simple Python-based web application to allow UGM students to fil
You can use an image file containing a QR code (can be obtained using a screenshot). Alternatively, you can just directly use the camera.

## Frequently Asked Questions (FAQ)

### Demo
The demo is available at https://lcat.dev/praesentia. Don't expect a 99.99% uptime, the server is an old Raspberry Pi 3.
The demo is available at https://lcat.dev/praesentia. Don't expect a 99.99% uptime, the server is an old Raspberry Pi 3. As a fallback, you can also use https://praesentia.herokuapp.com.

### Background
- Many UGM students are required to use SIMASTER mobile app to scan QR codes to fill their presence list. This mostly means that a student needs at least two devices to make the mechanism works.
- Two devices are not always available.

### API Source
I decompiled SIMASTER mobile app to get the source code. I also used interceptors to quickly recognize what was being sent and received.

### Working Principle
It works just like scanning QR in the SIMASTER mobile app.

### Side-effect
I don't think there is any except that you will get logged out of your SIMASTER app on your phone (just re-login, it will work again). I have never done research
about the API's rate-limiting or any possible ban.

## Installation and Deployment
Installation of Praesentia is fairly straightforward. You just need at least Python 3.6.

### Installing Requirements
This app only requires `flask` (to serve the web) and `requests` library (to call the API). You can install both using pip.
```
pip install flask requests
```
Or, you can install it using the `requirements.txt`:
```
pip install -r requirements.txt
```
It is recommended but not necessary to separate an app's environment by using a virtual environment (e.g. `venv`).

### Deployment
There are many ways to deploy Praesentia. You can use the following (but not limited to) ways:
- Gunicorn
Expand All @@ -35,6 +46,7 @@ gunicorn -b :6749 wsgi:app
```
python wsgi.py
```
- Heroku: there is already a `Procfile` file, feel free to use and/or edit it.

## Contribution
Contribution in any form will be highly appreciated.
Expand Down
12 changes: 12 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
certifi==2021.10.8
charset-normalizer==2.0.7
click==8.0.3
Flask==2.0.2
gunicorn==20.1.0
idna==3.3
itsdangerous==2.0.1
Jinja2==3.0.3
MarkupSafe==2.0.1
requests==2.26.0
urllib3==1.26.7
Werkzeug==2.0.2

0 comments on commit 397558e

Please sign in to comment.