22 lines
564 B
Python
22 lines
564 B
Python
import logging
|
|
|
|
from django.conf.urls import url
|
|
from django.core.exceptions import PermissionDenied
|
|
from django.http import HttpResponse
|
|
|
|
|
|
def helloworld(request):
|
|
logging.getLogger(__name__).error('wat!')
|
|
if 'raise' in request.GET:
|
|
raise Exception('wat!')
|
|
if 'forbidden' in request.GET:
|
|
raise PermissionDenied('forbidden access')
|
|
request.META['CSRF_COOKIE_USED'] = True
|
|
request.META['CSRF_COOKIE'] = 'xxx'
|
|
return HttpResponse('Hello world %s' % request.META['REMOTE_ADDR'])
|
|
|
|
|
|
urlpatterns = [
|
|
url(r'^$', helloworld),
|
|
]
|