Celestino Rey 10 months ago
parent
commit
7ca9e0c66c
2 changed files with 7 additions and 2 deletions
  1. +3
    -0
      src/mysite/settings.py
  2. +4
    -2
      src/mysite/urls.py

+ 3
- 0
src/mysite/settings.py View File

@ -130,6 +130,9 @@ USE_TZ = True
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'wsgi', 'static') STATIC_ROOT = os.path.join(BASE_DIR, 'wsgi', 'static')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'wsgi', 'static', 'mediafiles')
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field


+ 4
- 2
src/mysite/urls.py View File

@ -22,7 +22,9 @@ from django.conf import settings
urlpatterns = [ urlpatterns = [
path('polls/', include("polls.urls")), path('polls/', include("polls.urls")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
]
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""

Loading…
Cancel
Save