Skip to content

Commit d431751

Browse files
committed
fix: web API return 500 for static files
1 parent 49e1b78 commit d431751

File tree

5 files changed

+4
-14
lines changed

5 files changed

+4
-14
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ MIGRATION_NAME ?= ''
22

33

44
run:
5-
python manage.py runserver
5+
python manage.py runserver --noreload
66
migrations:
77
python manage.py makemigrations
88
migrate:

PastebinAPI/settings.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,11 @@
102102
2. Specify DB_NAME, DB_USER, DB_PASS, and DB_HOST Directly in the env file.
103103
"""
104104
# Update database configuration with dj_database_url
105-
heroku_default_db = dj_database_url.config()
105+
heroku_default_db = dj_database_url.config(conn_max_age=600)
106106
if bool(heroku_default_db):
107107
DATABASES = {"default": heroku_default_db}
108108
else:
109109
DATABASES = {
110-
# 'default': {
111-
# 'ENGINE': 'django.db.backends.sqlite3',
112-
# 'NAME': BASE_DIR / 'db.sqlite3',
113-
# }
114110
"default": {
115111
"ENGINE": "django.db.backends.postgresql_psycopg2",
116112
"NAME": config("DB_NAME"),

PastebinAPI/urls.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@
2222
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
2323
]
2424

25-
if settings.DEBUG:
26-
urlpatterns += static(settings.MEDIA_URL,
27-
document_root=settings.MEDIA_ROOT),
28-
urlpatterns += static(settings.STATIC_URL,
29-
document_root=settings.STATIC_ROOT),
30-
3125
urlpatterns += [
3226
path('', include('snippets.urls')),
3327
]

runtime.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.10.0
1+
python-3.10.14

snippets/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.0.4 on 2024-04-17 10:20
1+
# Generated by Django 5.0.4 on 2024-04-17 14:08
22

33
import django.db.models.deletion
44
from django.conf import settings

0 commit comments

Comments
 (0)