def urls(self): """Sets up the required urlconf for the admin views.""" try: # > 1.5 from django.conf.urls import patterns, url except ImportError as e: # < 1.5 from django.conf.urls.defaults import patterns, url def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view)(*args, **kwargs) return update_wrapper(wrapper, view) return patterns('', url(regex=r'^(?P<content_type>.+)/(?P<pk>.+)/$', view=self.view, name='%s_%s_change' % (self.model._meta.app_label, self.model._meta.module_name) ), url(regex=r'^$', view=self.index, name='%s_%s_changelist' % (self.model._meta.app_label, self.model._meta.module_name) ), )
def test_flatten_url_tree_url_import_with_routers(self): class MockApiViewSet(ModelViewSet): serializer_class = CommentSerializer model = User class AnotherMockApiViewSet(ModelViewSet): serializer_class = CommentSerializer model = User router = DefaultRouter() router.register(r'other_views', MockApiViewSet) router.register(r'more_views', MockApiViewSet) urls_app = patterns('', url(r'^', include(router.urls))) urls = patterns( '', url(r'api/', include(urls_app)), url(r'test/', include(urls_app)) ) urlparser = UrlParser() apis = urlparser.get_apis(urls) self.assertEqual(sum(api['path'].find('api') != -1 for api in apis), 4) self.assertEqual(sum(api['path'].find('test') != -1 for api in apis), 4)
def if_installed(appname, *args, **kwargs): ret = url(*args, **kwargs) if appname not in settings.INSTALLED_APPS: ret = url(r'^(\.(?P<response_format>\w+))?$', 'treeio.core.dashboard.views.index', name='home') #ret.resolve = lambda *args: None return ret
def prepend_urls(self): """ Add the following array of urls to the UserResource base urls """ resource_name = self._meta.resource_name return [ # register url(r"^(?P<resource_name>%s)/register%s$" % (resource_name, trailing_slash()), self.wrap_view('register'), name="api_register"), # login url(r"^(?P<resource_name>%s)/login%s$" % (resource_name, trailing_slash()), self.wrap_view('login'), name="api_login"), # logout url(r'^(?P<resource_name>%s)/logout%s$' % (resource_name, trailing_slash()), self.wrap_view('logout'), name='api_logout'), # is_authenticated url(r'^(?P<resource_name>%s)/is_authenticated%s$' % (resource_name, trailing_slash()), self.wrap_view('authenticated'), name='api_authenticated'), # recover password url(r'^(?P<resource_name>%s)/recover_password%s$' % (resource_name, trailing_slash()), self.wrap_view('recover_password'), name='api_recover_password'), ]
def get_urls(self): urlpatterns = patterns('', url(r'^$', self.make_request, name='sofort'), url(r'^success/$', self.success, name='sofort_success'), url(r'^notify/$', csrf_exempt(self.notify), name='sofort_notify'), ) return urlpatterns
def get_accounts_urls(self): urlpatterns = patterns('', url('^_accounts/sign-up/$', self.signup_view_class.as_view(), name='signup'), url('^_accounts/logout/$', self.logout_view_class.as_view(), name='logout'), url('^_accounts/login/$', self.login_view_class.as_view(), name='login'), ) return urlpatterns
def redirect_urls(model_admin, url_type): """change the url redirection.""" from django.conf.urls import patterns, url from functools import update_wrapper def wrap(view): """wrap the view fuction.""" def wrapper(*args, **kwargs): """return the wrapper.""" return model_admin.admin_site.admin_view(view)(*args, **kwargs) return update_wrapper(wrapper, view) info = model_admin.model._meta.app_label, model_admin.model._meta.module_name urlpatterns = patterns('', url(r'^$', wrap(designer_action_admin_list if url_type == "changelist" else \ model_admin.changelist_view), name='%s_%s_changelist' % info), url(r'^add/$', wrap(model_admin.add_view), name='%s_%s_add' % info), url(r'^(.+)/history/$', wrap(model_admin.history_view), name='%s_%s_history' % info), url(r'^(.+)/delete/$', wrap(model_admin.delete_view), name='%s_%s_delete' % info), url(r'^(.+)/$', wrap(designer_action_admin if url_type == "change" else model_admin.change_view), name='%s_%s_change' % info), ) return urlpatterns
def get_urls(self): """ Add a view to clear the current prescription from the session """ from django.conf.urls import patterns, url def wrap(view, cacheable=False): def wrapper(*args, **kwargs): return self.admin_view(view, cacheable)(*args, **kwargs) return update_wrapper(wrapper, view) urlpatterns = patterns( '', url(r'^administration/$', wrap(self.site_admin), name='site_admin'), url(r'^profile/$', wrap(self.profile), name='profile'), url(r'^endorse-authorise/$', wrap(self.endorse_authorise_summary), name='endorse_authorise_summary'), # url(r'^daily-burn-program/$', # wrap(self.daily_burn_program), # name='daily_burn_program'), # url(r'^daily-burn-program/add$', # wrap(self.daily_burn_program_add), # name='daily_burn_program_add'), url(r'^endorse-authorise/export_csv/$', wrap(self.export_to_csv), name='endorse_authorise_exportcsv'), ) return urlpatterns + super(PrescriptionSite, self).get_urls()
def base_urls(self): return [ url(r"^plugin/(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"), url(r"^plugin/(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"), ]
def get_urls(self, *args, **kwargs): def wrap(view, cacheable=False): def wrapper(*args, **kwargs): return self.admin_view(view, cacheable)(*args, **kwargs) return update_wrapper(wrapper, view) urlpatterns = super(AdminSite, self).get_urls(*args, **kwargs) urlpatterns += patterns('', url(r'^orders/fulfillment/$', self.admin_view(orders.views.fulfillment), name='admin_orders_fulfillment', ), url(r'^orders/fulfillment/mailing_stickers', self.admin_view(orders.views.mailing_stickers), name='admin_orders_mailing_stickers', ), url(r'^functions/add_test_customer', self.admin_view(customers.views.add_test_customer), name='admin_add_test_customer', ), url(r'^functions/move_orders_back', self.admin_view(orders.views.move_orders_back), name='admin_move_orders_back', ), ) return urlpatterns
def get_urls(self): """ Add a delete-translation view. """ urlpatterns = super(TranslatableAdmin, self).get_urls() if not self._has_translatable_model(): return urlpatterns else: opts = self.model._meta info = _get_model_meta(opts) if django.VERSION < (1, 9): delete_path = url( r'^(.+)/delete-translation/(.+)/$', self.admin_site.admin_view(self.delete_translation), name='{0}_{1}_delete_translation'.format(*info) ) else: delete_path = url( r'^(.+)/change/delete-translation/(.+)/$', self.admin_site.admin_view(self.delete_translation), name='{0}_{1}_delete_translation'.format(*info) ) return [delete_path] + urlpatterns
def _get_url_patterns(self): # Fetch the names of the views # ie: v1_foo_list list_view_name, detail_view_name = self._get_view_names() # Create url patterns # ie detail: r'foo/(?P<pk>\w+)/$ resource_pattern = [] api = getattr(self.Meta, "api", None) if api: resource_pattern.append(api.api_url) resource_pattern.append(self._get_resource_name()) resource_pattern = "/".join(resource_pattern) list_view_pattern = r"^{0}/$".format(resource_pattern) detail_view_pattern = r"^{0}/(?P<{1}>\w+)/$".format(resource_pattern, self.Meta.pk_field) # Form all the views list_view = url(list_view_pattern, self.view, name=list_view_name) detail_view = url(detail_view_pattern, self.view, name=detail_view_name) # Return list of patterns patterns = [] patterns.append(list_view) patterns.append(detail_view) return patterns
def register_views(queryset, urlpatterns=None): """ @param queryset queryset return urlpatterns format url(r'^login/', user.LoginUserViewt, name='loginurl'), """ if queryset is None: return urlpatterns for view_name in queryset: str_namespace = str(view_name.namespace) str_viewnames = str(view_name.viewname) str_url = str(view_name.url) str_urlname = str(view_name.url_name) if str_namespace == '' or str_viewnames == '' or str_url == '' or str_urlname == '': continue if urlpatterns: urlpatterns += patterns('%s' % str_namespace, url(r'^(?i)%s/$' % str_url, '%s' % str_viewnames, name='%s' % str_urlname), ) else: urlpatterns = patterns('%s' % namespace, url(r'^(?i)%s/$' % str_url, '%s' % str_viewnames, name='%s' % str_urlname), ) return urlpatterns
def get_urlpatterns(self): return super().get_urlpatterns() + [ url(r'^$', self.index_view, name='index'), url(r'^new/$', self.add_view, name='add'), url(r'^(\d+)/$', self.edit_view, name='edit'), url(r'^(\d+)/delete/$', self.delete_view, name='delete'), ]
def get_urls(self, prefix=None): prefix = prefix or self.app_name return patterns('', url(r'^$', self.index, name='index'), url(r'^(?P<order_token>[0-9a-zA-Z]+)/$', self.details, name='details'), )
def get_urls(self): """ Expose the custom URLs for the subclasses and the URL resolver. """ urls = super(PolymorphicParentModelAdmin, self).get_urls() info = self.model._meta.app_label, self.model._meta.module_name # Patch the change URL so it's not a big catch-all; allowing all custom URLs to be added to the end. # The url needs to be recreated, patching url.regex is not an option Django 1.4's LocaleRegexProvider changed it. new_change_url = url(r'^{0}/$'.format(self.pk_regex), self.admin_site.admin_view(self.change_view), name='{0}_{1}_change'.format(*info)) for i, oldurl in enumerate(urls): if oldurl.name == new_change_url.name: urls[i] = new_change_url # Define the catch-all for custom views custom_urls = patterns('', url(r'^(?P<path>.+)$', self.admin_site.admin_view(self.subclass_view)) ) # At this point. all admin code needs to be known. self._lazy_setup() # Add reverse names for all polymorphic models, so the delete button and "save and add" just work. # These definitions are masked by the definition above, since it needs special handling (and a ct_id parameter). dummy_urls = [] for model, _ in self.get_child_models(): admin = self._get_real_admin_by_model(model) dummy_urls += admin.get_urls() return urls + custom_urls + dummy_urls
def get_urls(self): """Adds in some custom admin URLs.""" admin_view = self.admin_site.admin_view return patterns("", url("^sitemap.json$", admin_view(self.sitemap_json_view), name="pages_page_sitemap_json"), url("^move-page/$", admin_view(self.move_page_view), name="pages_page_move_page"), ) + super(PageAdmin, self).get_urls()
def _decorated_urls(self): urlpatterns = self._get_default_urlpatterns() default_panel = None # Add in each panel's views except for the default view. for panel in self._registry.values(): if panel.slug == self.default_panel: default_panel = panel continue url_slug = panel.slug.replace('.', '/') urlpatterns += patterns('', url(r'^%s/' % url_slug, include(panel._decorated_urls))) # Now the default view, which should come last if not default_panel: raise NotRegistered('The default panel "%s" is not registered.' % self.default_panel) urlpatterns += patterns('', url(r'', include(default_panel._decorated_urls))) # Require login if not public. if not self.public: _decorate_urlconf(urlpatterns, require_auth) # Apply access controls to all views in the patterns permissions = getattr(self, 'permissions', []) _decorate_urlconf(urlpatterns, require_perms, permissions) _decorate_urlconf(urlpatterns, _current_component, dashboard=self) # Return the three arguments to django.conf.urls.include return urlpatterns, self.slug, self.slug
def setUp(self): self.url_patterns = patterns('', url(r'a-view/?$', MockApiView.as_view(), name='a test view'), url(r'a-view/child/?$', MockApiView.as_view()), url(r'a-view/<pk>/?$', MockApiView.as_view(), name="detailed view for mock"), url(r'another-view/?$', MockApiView.as_view(), name='another test view'), )
def setUp(self): self.url_patterns = patterns('', url(r'a-view/?$', MockApiView.as_view(), name='a test view'), url(r'a-view/child/?$', MockApiView.as_view()), url(r'a-view/child2/?$', MockApiView.as_view()), url(r'another-view/?$', MockApiView.as_view(), name='another test view'), )
def get_urls(self): from django.conf.urls import patterns, url def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view)(*args, **kwargs) return update_wrapper(wrapper, view) info = self.model._meta.app_label, self.model._meta.module_name urlpatterns = patterns( '', url(r'^history/$', wrap(self.history_view), {u'object_id': 1}, name='%s_%s_history' % info), url(r'^$', wrap(self.change_view), {u'object_id': 1}, name='%s_%s_change' % info), url(r'^$', wrap(self.changelist_view), name='%s_%s_changelist' % info), ) return urlpatterns
def prepend_urls(self): return [ url(r"^(?P<resource_name>%s)/search%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_search'), name="api_get_search"), url(r"^(?P<resource_name>%s)/get_last_id%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_last_id'), name="api_get_last_id"), ]
def get_urlpatterns(self): patterns = super(CordSubscriberViewSet, self).get_urlpatterns() patterns.append( self.detail_url("vcpe_synced/$", {"get": "get_vcpe_synced"}, "vcpe_synced") ) patterns.append( self.detail_url("url_filter/$", {"get": "get_url_filter"}, "url_filter") ) patterns.append( self.detail_url("url_filter/(?P<level>[a-zA-Z0-9\-_]+)/$", {"put": "set_url_filter"}, "url_filter") ) patterns.append( self.detail_url("services/$", {"get": "get_services"}, "services") ) patterns.append( self.detail_url("services/(?P<service>[a-zA-Z0-9\-_]+)/$", {"get": "get_service"}, "get_service") ) patterns.append( self.detail_url("services/(?P<service>[a-zA-Z0-9\-_]+)/true/$", {"put": "enable_service"}, "enable_service") ) patterns.append( self.detail_url("services/(?P<service>[a-zA-Z0-9\-_]+)/false/$", {"put": "disable_service"}, "disable_service") ) patterns.append( self.detail_url("users/$", {"get": "get_users", "post": "create_user"}, "users") ) patterns.append( self.detail_url("users/clearusers/$", {"get": "clear_users", "put": "clear_users", "post": "clear_users"}, "clearusers") ) patterns.append( self.detail_url("users/newuser/$", {"put": "create_user", "post": "create_user"}, "newuser") ) patterns.append( self.detail_url("users/(?P<uid>[0-9\-]+)/$", {"delete": "delete_user"}, "user") ) patterns.append( self.detail_url("users/(?P<uid>[0-9\-]+)/url_filter/$", {"get": "get_user_level"}, "user_level") ) patterns.append( self.detail_url("users/(?P<uid>[0-9\-]+)/url_filter/(?P<level>[a-zA-Z0-9\-_]+)/$", {"put": "set_user_level"}, "set_user_level") ) patterns.append( self.detail_url("bbsdump/$", {"get": "get_bbsdump"}, "bbsdump") ) patterns.append( url("^rs/initdemo/$", self.as_view({"put": "initdemo", "get": "initdemo"}), name="initdemo") ) patterns.append( url("^rs/subidlookup/(?P<ssid>[0-9\-]+)/$", self.as_view({"get": "ssiddetail"}), name="ssiddetail") ) patterns.append( url("^rs/subidlookup/$", self.as_view({"get": "ssidlist"}), name="ssidlist") ) patterns.append( url("^rs/vbng_mapping/$", self.as_view({"get": "get_vbng_mapping"}), name="vbng_mapping") ) return patterns
def urls(self): info = self.model._meta.app_label, self.model._meta.module_name return patterns('', url(r'^$', logfiles_list, name='%s_%s_changelist' % info, kwargs={'root_path': '/dcAdmin/tech_admin/'}), url(r'^(?P<logfile_id>\d+)/$', logfile_view, name='log-file-admin', kwargs={'root_path': '/dcAdmin/tech_admin/'}))
def get_urls(self): clone_view = ClonePageView.as_view(has_permission=self.has_add_permission) unpublish_view = UnpublishView.as_view(has_change_permission=self.has_change_permission) return [ url('^(.+)/clone/$', self.admin_site.admin_view(clone_view)), url('^(.+)/unpublish/$', self.admin_site.admin_view(unpublish_view)), ] + super(WidgyPageAdmin, self).get_urls()
def get_urls(self): urlpatterns = patterns('', url(r'^registration/$',self.user_registration.as_view(), name='registration' ), url(r'^profile/$',login_required(self.user_profile.as_view()), name='profile'), url(r'^signin/$',self.user_signin.as_view(), name='signin') ) return urlpatterns
def get_urls(self): urls = [ url(r'^twin/student/import(?:/([^/]+))?', student_import), url(r'^twin/groups(?:/([^/]+))?', make_groups) ] return urls + admin.AdminSite.get_urls(self)
def get_urls(self): ret = [] if self.include_root_view: root_url = url(r'^$', self.get_api_root_view(), name=self.root_view_name) ret.append(root_url) for prefix, viewset, basename in self.registry: lookup = self.get_lookup_regex(viewset) lookup_list = self.get_lookup_regexes(viewset) if lookup_list: # lookup = lookups[0] lookup_list = [u'/'.join(k) for k in lookup_list] else: lookup_list = [u''] routes = self.get_routes(viewset) for route in routes: mapping = self.get_method_map(viewset, route.mapping) if not mapping: continue for lookups in lookup_list: regex = route.url.format( prefix=prefix, lookup=lookup, lookups=lookups, trailing_slash=self.trailing_slash, extra=self.get_extra_lookup_regexes(route) ) view = viewset.as_view(mapping, **route.initkwargs) name = route.name.format(basename=basename) ret.append(url(regex, view, name=name)) if self.include_format_suffixes: ret = format_suffix_patterns(ret, allowed=['[a-z0-9]+']) return ret
def get_urls(self): return [ url(_(r'^mark/forums/$'), self.mark_forums_read_view.as_view(), name='mark_all_forums_read'), url(_(r'^mark/forums/(?P<pk>\d+)/$'), self.mark_forums_read_view.as_view(), name='mark_subforums_read'), url(_(r'^mark/forum/(?P<pk>\d+)/topics/$'), self.mark_topics_read_view.as_view(), name='mark_topics_read'), url(_(r'^unread-topics/$'), self.unread_topics_view.as_view(), name='unread_topics'), ]
def get_urls(cls): """Вовзвращает набор URL, актуальных для этой области. :return: """ views = [''] def add_view(view_name, url_name=None): if url_name is None: url_name = view_name views.append( url(getattr(cls, 'view_%s_url' % url_name), cls.get_view(view_name).as_view(), name=url_name) ) for view_name in cls.allowed_views: add_view(view_name) if view_name == 'details': add_view(view_name, 'details_slug') if cls.syndication_enabled: views.append(url(r'^%s/$' % SYNDICATION_URL_MARKER, cls.get_syndication_feed(), name='syndication')) _, realm_name_plural = cls.get_names() return patterns('', url(r'^%s/' % realm_name_plural, (patterns(*views), realm_name_plural, realm_name_plural)))
"""py35_django URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url,include from django.contrib import admin from app01 import views urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^home/', views.home), url(r'^news/(\d+)/(\d+)', views.news), url(r'^page/(?P<n1>\d+)/(?P<n2>\d+)', views.page), url(r'^app01/', include("app01.urls")), url(r'^app02/', include("app02.urls")), ]
from django.conf.urls import url from webApp.ws import consumers websocket_urlpatterns = [ url(r'^ws/poll/(?P<key>\w+)/answer/$', consumers.PollAnswerConsumer), ]
"""BookReviews URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include urlpatterns = [ url(r'^', include('apps.users_app.urls', namespace='users')), url(r'^books/', include('apps.books_app.urls', namespace='books')) ]
# -*- coding:utf-8 -*- from django.conf.urls import url from sign import views_if urlpatterns = [ # sign system interface: # ex : /api/add_event/ url(r'^add_event/', views_if.add_event, name='add_event'), # ex : /api/add_guest/ url(r'^add_guest/', views_if.add_guest, name='add_guest'), # ex : /api/get_event_list/ url(r'^get_event_list/', views_if.get_event_list, name='get_event_list'), # ex : /api/get_guest_list/ url(r'^get_guest_list/', views_if.get_guest_list, name='get_guest_list'), # ex : /api/user_sign/ url(r'^user_sign/', views_if.user_sign, name='user_sign'), ]
"""myansible URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url,include from django.contrib import admin import webansi.views ##no problem urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', webansi.views.mainpage, name='mainpage'), url(r'^webansi/', include('webansi.urls')), ]
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import include, url from django.contrib import admin from django.conf import settings from django.conf.urls.static import static urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^account/', include(arg='account.urls' )), url(r'^leads/', include(arg='hitarget.urls', namespace="hitarget", app_name="hitarget", )) ] # specific workaround to serve user images if settings.SETTING == "DEBUG": urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.db_edit, name='db-edit'), ]
from django.conf.urls import url from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), url(r'^home/', include('portal.urls')), ]
# coding=utf-8 from django.conf.urls import url, patterns urlpatterns = patterns( 'web.views.tag', url(r'^(?P<tag_hash>\w+)/$', 'tag_detail', name='web_tag_detail'), )
from django.conf.urls import url from django.contrib import admin from django.views.generic.base import TemplateView from . import views from django.views.generic.edit import CreateView from django.contrib.auth.forms import UserCreationForm from django.conf.urls import include from djgeojson.views import GeoJSONLayerView from .models import Data, CustomUser, Intersection from .forms import UserForm from django.conf.urls.static import static from django.conf import settings urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'), url(r'^login/$', views.login, name='login'), url(r'^logout/$', views.logout, name='logout'), url(r'^leaflet/$', views.leaflet, name='leaflet'), url(r'^register/$', views.register, name='register'), url(r'^data.geojson$', GeoJSONLayerView.as_view(model=Intersection), name='data'), url(r'^addElement/$', views.addElement, name='addElement'), url(r'^deleteElement/$', views.deleteElement, name='deleteElement'), url(r'^ranking/$', views.ranking, name='ranking'), url(r'^hrRanking/$', views.hrRanking, name='hrRanking'), url(r'^getCoordinates/$', views.getCoordinates, name='getCoordinates'), # url('^accounts/', include('django.contrib.auth.urls')), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""blog_project URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from rest_framework import routers from blog import views router = routers.DefaultRouter() router.register(r'users', views.UserViewSet) router.register(r'groups', views.GroupViewSet) urlpatterns = [ url(r'^admin/', include('admin.urls', namespace='admin', app_name='admin')), url(r'^api/', include(router.urls)), url(r'', include('blog.urls', namespace='blog', app_name='blog')), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), ]