示例#1
0
from django.conf.urls import url
from django.http import HttpResponse


from pytest_djangoapp.compat import get_urlpatterns


def raise_exception(request):
    raise Exception('This one should be handled by 500 technical view')


def index(request, some_id):

    if request.is_ajax():
        return HttpResponse('ajaxed')

    from django.templatetags.static import static
    return HttpResponse('%s | fine %s' % (some_id, static('blank.png')))


urlpatterns = get_urlpatterns([
    url(r'^index/(?P<some_id>\d+)/$', index, name='index'),
    url(r'^raiser/$', raise_exception, name='raiser'),
])
示例#2
0
from django.contrib import admin
from django.conf.urls import url

from pytest_djangoapp.compat import get_urlpatterns


urlpatterns = get_urlpatterns([
    url('admin/', admin.site.urls),
])
示例#3
0
from django.conf.urls import url
from pytest_djangoapp.compat import get_urlpatterns

from .views import index

urlpatterns = get_urlpatterns([
    url(r'^index/$', index, name='index'),
])
示例#4
0
from django.contrib import admin
from django.urls import path

from pytest_djangoapp.compat import get_urlpatterns

from .views import index

urlpatterns = get_urlpatterns([
    path('index/', index, name='index'),
    path('admin/', admin.site.urls),
])
示例#5
0
from django.conf.urls import url
from pytest_djangoapp.compat import get_urlpatterns

from sitegate.toolbox import get_sitegate_urls
from .views import login, register, HttpResponse


urlpatterns = get_urlpatterns([
    url(r'entrance/', lambda r: None),
    url(r'^ok/$', lambda r: HttpResponse('ok'), name='ok'),
    url(r'^fail/$', lambda r: HttpResponse('fail'), name='fail'),
    url(r'^login/$', login, name='login'),
    url(r'^register/$', register, name='register'),
] + get_sitegate_urls())