Skip to content

Instantly share code, notes, and snippets.

View abdulmoeez1225's full-sized avatar

Abdul Moeez abdulmoeez1225

View GitHub Profile
@abdulmoeez1225
abdulmoeez1225 / kill-all-connections-to-db.sql
Created October 28, 2022 08:12 — forked from jeffjohnson9046/kill-all-connections-to-db.sql
How to kill all connections to a Postgres database
-- Accepted answer from here: https://stackoverflow.com/questions/5408156/how-to-drop-a-postgresql-database-if-there-are-active-connections-to-it
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = '[your database name goes here]'
AND pid <> pg_backend_pid();
@abdulmoeez1225
abdulmoeez1225 / urls.py
Created October 5, 2022 08:38 — forked from vitorfs/urls.py
Serving Django Media Files During Development
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# Project url patterns...
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)