mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 08:14:16 +03:00
Delete robots.txt, favicon.ico views; Move style to a new static namespace
This commit is contained in:
parent
ba1e3b4699
commit
9c8ca51c78
1
AUTHORS
1
AUTHORS
|
@ -30,6 +30,7 @@ Chris Pickett <bunchesofdonald>
|
|||
Ben Timby <btimby>
|
||||
Michele Lazzeri <michelelazzeri-nextage>
|
||||
Camille Harang <mammique>
|
||||
Paul Oswald <poswald>
|
||||
|
||||
THANKS TO:
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
|
@ -1,2 +0,0 @@
|
|||
User-agent: *
|
||||
Disallow: /
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}css/djangorestframework.css'/>
|
||||
<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}djangorestframework/css/style.css'/>
|
||||
</head>
|
||||
|
||||
<body class="login">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% load static %}
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}css/djangorestframework.css'/>
|
||||
<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}djangorestframework/css/style.css'/>
|
||||
<title>Django REST framework - {{ name }}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -46,8 +46,6 @@ class MockResource(ModelResource):
|
|||
fields = ('foo', 'bar', 'baz')
|
||||
|
||||
urlpatterns = patterns('djangorestframework.utils.staticviews',
|
||||
url(r'^robots.txt$', 'deny_robots'),
|
||||
url(r'^favicon.ico$', 'favicon'),
|
||||
url(r'^accounts/login$', 'api_login'),
|
||||
url(r'^accounts/logout$', 'api_logout'),
|
||||
url(r'^mock/$', MockView.as_view()),
|
||||
|
@ -123,18 +121,6 @@ class ExtraViewsTests(TestCase):
|
|||
"""Test the extra views djangorestframework provides"""
|
||||
urls = 'djangorestframework.tests.views'
|
||||
|
||||
def test_robots_view(self):
|
||||
"""Ensure the robots view exists"""
|
||||
response = self.client.get('/robots.txt')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response['Content-Type'], 'text/plain')
|
||||
|
||||
def test_favicon_view(self):
|
||||
"""Ensure the favicon view exists"""
|
||||
response = self.client.get('/favicon.ico')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response['Content-Type'], 'image/vnd.microsoft.icon')
|
||||
|
||||
def test_login_view(self):
|
||||
"""Ensure the login view exists"""
|
||||
response = self.client.get('/accounts/login')
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
from django.conf.urls.defaults import patterns
|
||||
from django.conf import settings
|
||||
|
||||
urlpatterns = patterns('djangorestframework.utils.staticviews',
|
||||
(r'robots.txt', 'deny_robots'),
|
||||
(r'^accounts/login/$', 'api_login'),
|
||||
(r'^accounts/logout/$', 'api_logout'),
|
||||
)
|
||||
|
||||
# Only serve favicon in production because otherwise chrome users will pretty much
|
||||
# permanantly have the django-rest-framework favicon whenever they navigate to
|
||||
# 127.0.0.1:8000 or whatever, which gets annoying
|
||||
if not settings.DEBUG:
|
||||
urlpatterns += patterns('djangorestframework.utils.staticviews',
|
||||
(r'favicon.ico', 'favicon'),
|
||||
)
|
||||
|
|
|
@ -6,15 +6,6 @@ from django.template import RequestContext
|
|||
import base64
|
||||
|
||||
|
||||
def deny_robots(request):
|
||||
return HttpResponse('User-agent: *\nDisallow: /', mimetype='text/plain')
|
||||
|
||||
|
||||
def favicon(request):
|
||||
data = 'AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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F+U5GRf9ORkX/TkZF/05GRf9ORkX/TkZF/05GRf9ORkX/TkZF/1BJSP/CwsLmy8vLDwAAAAAAAAAAAAAAAE5GRRJORkXtTkZF9FFJSJ1ORkXJTkZF/05GRf9ORkX/ZF5d9k5GRZ9ORkXtTkZF5HFsaxUAAAAAAAAAAAAAAAAAAAAAAAAAAE5GRQxORkUJAAAAAAAAAABORkXhTkZF/2JbWv7Ly8tgAAAAAAAAAABORkUGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE5GRWBORkX2TkZFYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//+AAP9/gAD+P4AA4AOAAMADgADAA4AAwAOAAMMBgACCAIAAAAGAAIBDgADAA4AAwAOAAMADgADAB4AA/H+AAP7/gAA='
|
||||
return HttpResponse(base64.b64decode(data), mimetype='image/vnd.microsoft.icon')
|
||||
|
||||
|
||||
# BLERGH
|
||||
# Replicate django.contrib.auth.views.login simply so we don't have get users to update TEMPLATE_CONTEXT_PROCESSORS
|
||||
# to add ADMIN_MEDIA_PREFIX to the RequestContext. I don't like this but really really want users to not have to
|
||||
|
|
|
@ -37,16 +37,15 @@ The Python `markdown library <http://www.freewisdom.org/projects/python-markdown
|
|||
If markdown is installed your :class:`.Resource` descriptions can include `markdown style formatting
|
||||
<http://daringfireball.net/projects/markdown/syntax>`_ which will be rendered by the HTML documenting renderer.
|
||||
|
||||
robots.txt, favicon, login/logout
|
||||
login/logout
|
||||
---------------------------------
|
||||
|
||||
Django REST framework comes with a few views that can be useful including a deny robots view, a favicon view, and api login and logout views::
|
||||
Django REST framework comes with a few views that can be useful including an api
|
||||
login and logout views::
|
||||
|
||||
from django.conf.urls.defaults import patterns
|
||||
|
||||
urlpatterns = patterns('djangorestframework.views',
|
||||
(r'robots.txt', 'deny_robots'),
|
||||
(r'favicon.ico', 'favicon'),
|
||||
# Add your resources here
|
||||
(r'^accounts/login/$', 'api_login'),
|
||||
(r'^accounts/logout/$', 'api_logout'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user