Skip to content

Instantly share code, notes, and snippets.

View alyahmady's full-sized avatar
🤔

Aly Ahmady alyahmady

🤔
View GitHub Profile
@alyahmady
alyahmady / metadata.py
Created June 3, 2024 09:14
OPTIONS method and metadata in DRF Spectacular
# apps/core/metadata.py
from collections import OrderedDict
from django.utils.encoding import force_str
from rest_framework import serializers
from rest_framework.metadata import SimpleMetadata
from rest_framework.request import clone_request
@alyahmady
alyahmady / .env
Last active December 11, 2025 04:16
Caddy + Next.js + Docker build
DOMAIN=http//:localhost
# For production, use a real domain without scheme (http:// or https://) to be served with auto-renewal HTTPS/SSL
# DOMAIN=example.com
@alyahmady
alyahmady / django_query_logger.py
Last active March 29, 2024 11:24
Django database query logger
# Credits to https://stackoverflow.com/a/68194120
import time
from django.db import connection
class QueryLogger:
def __init__(self):
self.queries = []