You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xenua
b65a45a5ff
|
2 years ago | |
---|---|---|
leftists | 2 years ago | |
lonk | 2 years ago | |
tests | 2 years ago | |
.gitignore | 2 years ago | |
README.md | 2 years ago | |
manage.py | 2 years ago | |
requirements-dev.txt | 2 years ago | |
requirements.txt | 2 years ago |
README.md
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
-
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
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.
- set it to
- I personally have had a good experience with running gunicorn behind nginx.
- or at the very least, turn off debug mode and generate a proper secret (e.g.
$ openssl rand -base64 64
)
- follow the official documentation
(speculative) FAQ
Q: performance? in a django project?
A: yes! it does 1400 requests per second on the redirect endpoints in a basic deployment1.
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 headers2
Q: how do I remove domains?
A: currently, through the backend shell. Front end domain management will be added in a future release.
-
gunicorn -w 2 lonk.wsgi:application
, no proxy ↩︎ -
specifically, it uses
request.get_host()
, see the documentation for details ↩︎