Example #1
0
 def test_get(self):
     resp = self.cli.get("/")
     self.assertEqual(resp.status_code, 200)
     self.assertEqual(len(resp.templates), 2)
     self.assertEqual([_t.name for _t in resp.templates],
                      ["index/index.html", "base.html"])
     self.assertEqual(resp.resolver_match.func.__name__,
                      IndexView.as_view().__name__)
Example #2
0
from django.urls import path

# from apps.index.views import view_index
from apps.index.views import IndexView

urlpatterns = [
    path('', IndexView.as_view(), name="index"),
]
Example #3
0
File: urls.py Project: Gul-lug/re
from django.urls import path
from django.views.generic import TemplateView

from apps.index.apps import IndexConfig
from apps.index.views import IndexView

app_name = IndexConfig.label

urlpatterns = [
    path("", IndexView.as_view(), name="index",),
]
Example #4
0
"""
from django.contrib import admin
from django.urls import path, re_path
from apps.index.views import IndexView
from django.urls import include

from mysite.settings import MEDIA_ROOT
from mysite.settings import MEDIA_URL
from django.views.static import serve

# 缓存服务
from django.views.decorators.cache import cache_page

urlpatterns = [
    path('admin/', admin.site.urls),
    path('',  cache_page(1)(IndexView.as_view()), name="index"),
    path('user/', include("apps.user.urls")),

    path('search/', include("apps.search.urls")),

    # capthca
    path('captcha/', include('captcha.urls')),

    # blog
    path('blog/', include('apps.blog.urls')),

    # MEDIA_URL配置
    re_path('media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}),

    path('mdeditor/', include('mdeditor.urls')),
]
Example #5
0
from django.conf.urls import url

from apps.index.views import IndexView

urlpatterns = [
    url(r'^$', IndexView.as_view(), name="index"),
]
Example #6
0
    url(r'^admin/doc/',           include('django.contrib.admindocs.urls'),         name='admin_doc'),
    url(r'^admin/',               include(admin.site.urls),                         name='admin'),
    url(r'^comments/',            include('django.contrib.comments.urls')),
    url(r'^tags/',                include('universaltag.urls')),
    url(r'^control/',             include('Kommonz.apps.control.urls')),
    url(r'^categories/',          include('Kommonz.apps.categories.urls')),
    url(r'^keros/',               include('Kommonz.apps.keros.urls')),
    url(r'^lists/',               include('Kommonz.apps.lists.urls')),
    url(r'^registration/',        include('Kommonz.apps.registration.urls')),
    url(r'^materials/',           include('Kommonz.apps.materials.urls')),
    url(r'^messages/',            include('Kommonz.apps.messages.urls')),
    url(r'^notifications/',       include('Kommonz.apps.notifications.urls')),
    url(r'^reports/',             include('Kommonz.apps.reports.urls')),
    url(r'^searches/',            include('Kommonz.apps.searches.urls')),
    url(r'^users/',               include('Kommonz.apps.auth.urls')),
    url(r'^$',                    IndexView.as_view(),                              name='index')
)

from django.conf import settings
if settings.DEBUG:
    import os.path
    document_root = lambda x: os.path.join(os.path.dirname(__file__), x)
    urlpatterns += patterns('django.views.static',
        (r'^favicon.ico$',              'serve', {'document_root': document_root('../../static'), 'path': 'favicon.ico'}),
        (r'^apple-touch-icon.png$',     'serve', {'document_root': document_root('../../static'), 'path': 'apple-touch-icon.png'}),
        (r'^css/(?P<path>.*)$',         'serve', {'document_root': document_root('../../static/css')}),
        (r'^javascript/(?P<path>.*)$',  'serve', {'document_root': document_root('../../static/javascript')}),
        (r'^image/(?P<path>.*)$',       'serve', {'document_root': document_root('../../static/image')}),
        (r'^storage/(?P<path>.*)$',     'serve', {'document_root': document_root('../../static/storage')}),
    )