xenua
2 years ago
1 changed files with 47 additions and 0 deletions
@ -0,0 +1,47 @@ |
|||||||
|
# lonk |
||||||
|
|
||||||
|
...is a simple, hackable link shortener with good enough performance |
||||||
|
|
||||||
|
[python >= 3.8] [django >= 4.0] |
||||||
|
|
||||||
|
How the fuck do I deploy this?? |
||||||
|
--- |
||||||
|
|
||||||
|
**Development:** |
||||||
|
|
||||||
|
- clone the repo |
||||||
|
- set up python environment |
||||||
|
- ```bash |
||||||
|
python3 -m venv env |
||||||
|
source env/bin/activate |
||||||
|
pip install -r requirements.txt |
||||||
|
``` |
||||||
|
- `./manage.py migrate` |
||||||
|
- `./manage.py createsuperuser` |
||||||
|
- `./manage.py runserver` |
||||||
|
|
||||||
|
**Production:** |
||||||
|
|
||||||
|
- clone the repo |
||||||
|
- take a look through the settings.py file |
||||||
|
- follow the [official documentation](https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/) |
||||||
|
- `ALLOWED_HOSTS` differs for this project. either: |
||||||
|
- set it to `["*"]` and run behind a http reverse proxy that matches by host header |
||||||
|
- set it to a list of all domains that should be served. |
||||||
|
- I personally have had a good experience with running [gunicorn](https://gunicorn.org/) behind nginx. |
||||||
|
- or at the very least, turn off debug mode and generate a proper secret (e.g. `$ openssl rand -base64 64`) |
||||||
|
|
||||||
|
(speculative) FAQ |
||||||
|
--- |
||||||
|
|
||||||
|
Q: performance? in a django project?\ |
||||||
|
A: yes! it does 1400 requests per second on the redirect endpoints in a basic deployment[^1]. |
||||||
|
|
||||||
|
Q: my other domains aren't showing up? how do I tell lonk that they exist?\ |
||||||
|
A: simply access lonk on those domains! it'll pick them up by http host headers[^2] |
||||||
|
|
||||||
|
Q: how do I remove domains?\ |
||||||
|
A: currently, through the backend shell. Front end domain management will be added in a future release. |
||||||
|
|
||||||
|
[^1]: `gunicorn -w 2 lonk.wsgi:application`, no proxy |
||||||
|
[^2]: specifically, it uses `request.get_host()`, see [the documentation](https://docs.djangoproject.com/en/4.0/ref/request-response/#django.http.HttpRequest.get_host) for details |
Loading…
Reference in new issue