SushantGautam commited on
Commit
3e924b8
·
1 Parent(s): be8d1c8

Add static and media URL handling for development in urls.py

Browse files
Files changed (1) hide show
  1. BridgeMentor/urls.py +9 -0
BridgeMentor/urls.py CHANGED
@@ -14,6 +14,8 @@ Including another URLconf
14
  1. Import the include() function: from django.urls import include, path
15
  2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16
  """
 
 
17
  from graphene_django.views import GraphQLView
18
  from django.contrib import admin
19
  from django.contrib.auth import logout
@@ -37,3 +39,10 @@ urlpatterns = [
37
 
38
 
39
  ]
 
 
 
 
 
 
 
 
14
  1. Import the include() function: from django.urls import include, path
15
  2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16
  """
17
+ from django.conf.urls.static import static
18
+ from django.conf import settings
19
  from graphene_django.views import GraphQLView
20
  from django.contrib import admin
21
  from django.contrib.auth import logout
 
39
 
40
 
41
  ]
42
+
43
+
44
+ if settings.DEBUG:
45
+ urlpatterns += static(settings.STATIC_URL,
46
+ document_root=settings.STATIC_ROOT)
47
+ urlpatterns += static(settings.MEDIA_URL,
48
+ document_root=settings.MEDIA_ROOT)