Commit 4109268a authored by John Red Medrano's avatar John Red Medrano

Merge pull request #660 in RMS/api-main-service from red-develop to product-dev

* commit '47aaa0ec':
  fixing issue on serving media files
parents 2b25c599 47aaa0ec
...@@ -128,13 +128,8 @@ USE_TZ = False ...@@ -128,13 +128,8 @@ USE_TZ = False
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/ # https://docs.djangoproject.com/en/2.2/howto/static-files/
if DEBUG:
STATIC_ROOT = os.path.join(BASE_DIR, '/static')
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/' STATIC_URL = '/static/'
# STATIC_ROOT = os.path.join(BASE_DIR, "static") STATIC_ROOT = os.path.join(BASE_DIR, "static")
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/' MEDIA_URL = '/media/'
......
...@@ -13,6 +13,7 @@ Including another URLconf ...@@ -13,6 +13,7 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
import os
from django.contrib import admin from django.contrib import admin
from django.urls import path, include, re_path from django.urls import path, include, re_path
from django.conf.urls import url from django.conf.urls import url
...@@ -20,7 +21,6 @@ from app.applicationlayer.management.notification import views as notifview ...@@ -20,7 +21,6 @@ from app.applicationlayer.management.notification import views as notifview
from django.views.static import serve from django.views.static import serve
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
import django.views.static as try_static
urlpatterns = [ urlpatterns = [
...@@ -43,4 +43,17 @@ if settings.DEBUG: ...@@ -43,4 +43,17 @@ if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += 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)
else: else:
urlpatterns += [url(r'^static/(?P<path>.*)$', django.views.static.serve, {'document_root': try_static.STATIC_ROOT, 'show_indexes': try_static.DEBUG})] urlpatterns += patterns(
\ No newline at end of file '',
(r'^static/(?P<path>.*)$',
'django.views.static.serve',
{'document_root': os.path.join(os.path.dirname(__file__), 'static')} ),
)
# if settings.DEBUG404:
# urlpatterns += patterns('',
# (r'^static/(?P<path>.*)$', 'django.views.static.serve',
# {'document_root': os.path.join(os.path.dirname(__file__), 'static')} ),
# )
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment