mirror of
https://github.com/quantum5/qlinks.git
synced 2025-08-04 00:58:53 -04:00
18 lines
500 B
Python
18 lines
500 B
Python
from django.conf import settings
|
|
from django.http import HttpResponse, HttpResponseRedirect
|
|
from django.shortcuts import get_object_or_404
|
|
|
|
from qlinks.models import Link
|
|
|
|
|
|
def short_link(request, path):
|
|
link = get_object_or_404(Link.objects.values_list('long', flat=True), short=path)
|
|
return HttpResponseRedirect(link, headers={
|
|
'X-Powered-By': settings.QLINKS_POWERED_BY
|
|
})
|
|
|
|
|
|
def health_check(request):
|
|
Link.objects.exists()
|
|
return HttpResponse('qlinks seems to work!')
|