from django.conf import settings from django.conf.urls.static import static as django_static from django.contrib import admin from django.urls import include, path urlpatterns = [ path("admin/", admin.site.urls, name='admin'), path('', include('bidpazari.core.urls')), ] if settings.DEBUG: # In production environments, /media/ should be hosted by nginx urlpatterns += django_static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
import re from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static as django_static from django.contrib.auth.decorators import login_required from django.views.static import serve from . import auth urlpatterns = [] urlpatterns += django_static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += [ url(r'^api/v1/', include(('zazi.apps.banking.urls', 'banking'), namespace='banking')), url(r'^api/v1/', include(('zazi.apps.identity.urls', 'identity'), namespace='identity')), url(r'^api/v1/', include(('zazi.apps.loan.urls', 'loans'), namespace='loans')), url(r'^api/v1/', include(('zazi.apps.mpesa.urls', 'mpesa'), namespace='mpesa')), url(r'^api/v1/', include(('zazi.apps.users.urls', 'users'), namespace='users')), url(r'^api/v1/', include(('zazi.apps.loan_ledger.urls', 'loan_ledger'), namespace='loan_ledger')), ] if settings.SHOW_ADMIN: from django.contrib import admin urlpatterns += [ url(r'^admin/', admin.site.urls)]
def static(prefix, view=serve, **kwargs): return django_static(prefix, view, **kwargs)
from django.conf.urls import url, include from django.contrib import admin from accounts import urls as urls_accounts from products import urls as urls_products from home.views import home from cart import urls as urls_cart from information import urls as urls_information from search import urls as urls_search from checkout import urls as urls_checkout from products.views import all_products from django.views import static from .settings import MEDIA_ROOT from django.views.generic import RedirectView from django.conf import settings from django.conf.urls.static import static as django_static urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', home, name='index'), url(r'^products/$', all_products, name='products'), url(r'^accounts/', include(urls_accounts)), url(r'^information/', include(urls_information)), url(r'^products/', include(urls_products)), url(r'^cart/', include(urls_cart)), url(r'^checkout/', include(urls_checkout)), url(r'^search/', include(urls_search)), url(r'^media/(?P<path>.*)$', static.serve, {'document_root': MEDIA_ROOT}), ] + django_static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)