Serve media files
This commit is contained in:
parent
082afc26e6
commit
13fb8f7f3e
2 changed files with 10 additions and 0 deletions
|
@ -134,3 +134,8 @@ USE_TZ = True
|
|||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static')
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'media')
|
||||
SERVE_MEDIA_FILES = DEBUG
|
|
@ -15,9 +15,14 @@ Including another URLconf
|
|||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('inventory.urls')),
|
||||
path('accounts/', include('django.contrib.auth.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
||||
if settings.SERVE_MEDIA_FILES:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
|
Loading…
Reference in a new issue