from django.conf.urls import url, patterns from news.views import IndexView urlpatterns = patterns( '', url(r'^', IndexView.as_view(), name="index") )
from apscheduler.schedulers.background import BackgroundScheduler import xadmin from news.views import IndexView from custom.views import IntroduceView urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url(r'^ueditor/', include('DjangoUeditor.urls')), url(r'^news/', include('news.urls', namespace='news')), url(r'^work/', include('work.urls', namespace='work')), url(r'^resources/', include('resources.urls', namespace='resources')), url(r'^communication/', include('communication.urls', namespace='communication')), url(r'^$', IndexView.as_view(), name='Index'), url(r'^introduce/$', IntroduceView.as_view(), name='introduce'), url(r'^operation/', include('operation.urls', namespace='operation')), #配置上传文件访问处理 url(r'^media/(?P<path>.*)$', serve, {"document_root": settings.MEDIA_ROOT}), #静态文件访问路径 # url(r'^static/(?P<path>.*)$', serve, {'document_root': settings.STATIC_ROOT}), ] #全局404,500的配置 handler404 = 'work.views.page_not_found' handler500 = 'work.views.page_error' #定时函数 # sched = BackgroundScheduler()
from django.conf.urls import patterns, include, url from news.views import IndexView urlpatterns = patterns('news.views', url(r'^$', IndexView.as_view(), name='news_index'), url(r'^parser$', 'parser', name='parser'), )
from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.static import serve from news.views import IndexView admin.autodiscover() urlpatterns = [ url(r'^sitemap\.xml$', sitemap, {'sitemaps': { 'cmspages': CMSSitemap }}), ] #urlpatterns += i18n_patterns( urlpatterns += ( url(r'^$', IndexView.as_view(), name='pages-root'), # Overrides '^$' from cms.urls url(r'^news/$', IndexView.as_view(), name='pages-root'), # Overrides '^$' from cms.urls url(r'^admin/', include(admin.site.urls)), url(r'^', include('cms.urls')), #url(r'^vk_news/', include('news.urls')), ) #handler500 = news.views.error_500 # This is only needed when using runserver. #if settings.DEBUG: urlpatterns = [ url(r'^media/(?P<path>.*)$', serve, { 'document_root': settings.MEDIA_ROOT,
"""hypernews URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from news.views import IndexView, NewsView, NewsPageView, NewsCreate from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('', IndexView.as_view()), path('news/', NewsView.as_view()), path('news/create/', NewsCreate.as_view()), path('news/<link>/', NewsPageView.as_view()), ] urlpatterns += static(settings.STATIC_URL)