mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
Merge pull request #162 from poswald/master
Remove robots.txt, favicon.ico; namespace static files
This commit is contained in:
commit
426493a78f
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:
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ tfoot td {
|
|||
color: #666;
|
||||
padding: 2px 5px;
|
||||
font-size: 11px;
|
||||
background: #e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x;
|
||||
background: #e1e1e1 url(../../admin/img/admin/nav-bg.gif) top left repeat-x;
|
||||
border-left: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
@ -317,11 +317,11 @@ table thead th.sorted a {
|
|||
}
|
||||
|
||||
table thead th.ascending a {
|
||||
background: url(../img/admin/arrow-up.gif) right .4em no-repeat;
|
||||
background: url(../../admin/img/admin/arrow-up.gif) right .4em no-repeat;
|
||||
}
|
||||
|
||||
table thead th.descending a {
|
||||
background: url(../img/admin/arrow-down.gif) right .4em no-repeat;
|
||||
background: url(../../admin/img/admin/arrow-down.gif) right .4em no-repeat;
|
||||
}
|
||||
|
||||
/* ORDERABLE TABLES */
|
||||
|
@ -332,7 +332,7 @@ table.orderable tbody tr td:hover {
|
|||
|
||||
table.orderable tbody tr td:first-child {
|
||||
padding-left: 14px;
|
||||
background-image: url(../img/admin/nav-bg-grabber.gif);
|
||||
background-image: url(../../admin/img/admin/nav-bg-grabber.gif);
|
||||
background-repeat: repeat-y;
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ input[type=text], input[type=password], textarea, select, .vTextField {
|
|||
/* FORM BUTTONS */
|
||||
|
||||
.button, input[type=submit], input[type=button], .submit-row input {
|
||||
background: white url(../img/admin/nav-bg.gif) bottom repeat-x;
|
||||
background: white url(../../admin/img/admin/nav-bg.gif) bottom repeat-x;
|
||||
padding: 3px 5px;
|
||||
color: black;
|
||||
border: 1px solid #bbb;
|
||||
|
@ -370,31 +370,31 @@ input[type=text], input[type=password], textarea, select, .vTextField {
|
|||
}
|
||||
|
||||
.button:active, input[type=submit]:active, input[type=button]:active {
|
||||
background-image: url(../img/admin/nav-bg-reverse.gif);
|
||||
background-image: url(../../admin/img/admin/nav-bg-reverse.gif);
|
||||
background-position: top;
|
||||
}
|
||||
|
||||
.button[disabled], input[type=submit][disabled], input[type=button][disabled] {
|
||||
background-image: url(../img/admin/nav-bg.gif);
|
||||
background-image: url(../../admin/img/admin/nav-bg.gif);
|
||||
background-position: bottom;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.button.default, input[type=submit].default, .submit-row input.default {
|
||||
border: 2px solid #5b80b2;
|
||||
background: #7CA0C7 url(../img/admin/default-bg.gif) bottom repeat-x;
|
||||
background: #7CA0C7 url(../../admin/img/admin/default-bg.gif) bottom repeat-x;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.button.default:active, input[type=submit].default:active {
|
||||
background-image: url(../img/admin/default-bg-reverse.gif);
|
||||
background-image: url(../../admin/img/admin/default-bg-reverse.gif);
|
||||
background-position: top;
|
||||
}
|
||||
|
||||
.button[disabled].default, input[type=submit][disabled].default, input[type=button][disabled].default {
|
||||
background-image: url(../img/admin/default-bg.gif);
|
||||
background-image: url(../../admin/img/admin/default-bg.gif);
|
||||
background-position: bottom;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ input[type=text], input[type=password], textarea, select, .vTextField {
|
|||
font-size: 11px;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
background: #7CA0C7 url(../img/admin/default-bg.gif) top left repeat-x;
|
||||
background: #7CA0C7 url(../../admin/img/admin/default-bg.gif) top left repeat-x;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
@ -453,15 +453,15 @@ ul.messagelist li {
|
|||
margin: 0 0 3px 0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
color: #666;
|
||||
background: #ffc url(../img/admin/icon_success.gif) 5px .3em no-repeat;
|
||||
background: #ffc url(../../admin/img/admin/icon_success.gif) 5px .3em no-repeat;
|
||||
}
|
||||
|
||||
ul.messagelist li.warning{
|
||||
background-image: url(../img/admin/icon_alert.gif);
|
||||
background-image: url(../../admin/img/admin/icon_alert.gif);
|
||||
}
|
||||
|
||||
ul.messagelist li.error{
|
||||
background-image: url(../img/admin/icon_error.gif);
|
||||
background-image: url(../../admin/img/admin/icon_error.gif);
|
||||
}
|
||||
|
||||
.errornote {
|
||||
|
@ -471,7 +471,7 @@ ul.messagelist li.error{
|
|||
margin: 0 0 3px 0;
|
||||
border: 1px solid red;
|
||||
color: red;
|
||||
background: #ffc url(../img/admin/icon_error.gif) 5px .3em no-repeat;
|
||||
background: #ffc url(../../admin/img/admin/icon_error.gif) 5px .3em no-repeat;
|
||||
}
|
||||
|
||||
ul.errorlist {
|
||||
|
@ -486,7 +486,7 @@ ul.errorlist {
|
|||
margin: 0 0 3px 0;
|
||||
border: 1px solid red;
|
||||
color: white;
|
||||
background: red url(../img/admin/icon_alert.gif) 5px .3em no-repeat;
|
||||
background: red url(../../admin/img/admin/icon_alert.gif) 5px .3em no-repeat;
|
||||
}
|
||||
|
||||
.errorlist li a {
|
||||
|
@ -522,7 +522,7 @@ div.system-message p.system-message-title {
|
|||
padding: 4px 5px 4px 25px;
|
||||
margin: 0;
|
||||
color: red;
|
||||
background: #ffc url(../img/admin/icon_error.gif) 5px .3em no-repeat;
|
||||
background: #ffc url(../../admin/img/admin/icon_error.gif) 5px .3em no-repeat;
|
||||
}
|
||||
|
||||
.description {
|
||||
|
@ -533,7 +533,7 @@ div.system-message p.system-message-title {
|
|||
/* BREADCRUMBS */
|
||||
|
||||
div.breadcrumbs {
|
||||
background: white url(../img/admin/nav-bg-reverse.gif) 0 -10px repeat-x;
|
||||
background: white url(../../admin/img/admin/nav-bg-reverse.gif) 0 -10px repeat-x;
|
||||
padding: 2px 8px 3px 8px;
|
||||
font-size: 11px;
|
||||
color: #999;
|
||||
|
@ -546,17 +546,17 @@ div.breadcrumbs {
|
|||
|
||||
.addlink {
|
||||
padding-left: 12px;
|
||||
background: url(../img/admin/icon_addlink.gif) 0 .2em no-repeat;
|
||||
background: url(../../admin/img/admin/icon_addlink.gif) 0 .2em no-repeat;
|
||||
}
|
||||
|
||||
.changelink {
|
||||
padding-left: 12px;
|
||||
background: url(../img/admin/icon_changelink.gif) 0 .2em no-repeat;
|
||||
background: url(../../admin/img/admin/icon_changelink.gif) 0 .2em no-repeat;
|
||||
}
|
||||
|
||||
.deletelink {
|
||||
padding-left: 12px;
|
||||
background: url(../img/admin/icon_deletelink.gif) 0 .25em no-repeat;
|
||||
background: url(../../admin/img/admin/icon_deletelink.gif) 0 .25em no-repeat;
|
||||
}
|
||||
|
||||
a.deletelink:link, a.deletelink:visited {
|
||||
|
@ -591,14 +591,14 @@ a.deletelink:hover {
|
|||
.object-tools li {
|
||||
display: block;
|
||||
float: left;
|
||||
background: url(../img/admin/tool-left.gif) 0 0 no-repeat;
|
||||
background: url(../../admin/img/admin/tool-left.gif) 0 0 no-repeat;
|
||||
padding: 0 0 0 8px;
|
||||
margin-left: 2px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.object-tools li:hover {
|
||||
background: url(../img/admin/tool-left_over.gif) 0 0 no-repeat;
|
||||
background: url(../../admin/img/admin/tool-left_over.gif) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
.object-tools a:link, .object-tools a:visited {
|
||||
|
@ -607,29 +607,29 @@ a.deletelink:hover {
|
|||
color: white;
|
||||
padding: .1em 14px .1em 8px;
|
||||
height: 14px;
|
||||
background: #999 url(../img/admin/tool-right.gif) 100% 0 no-repeat;
|
||||
background: #999 url(../../admin/img/admin/tool-right.gif) 100% 0 no-repeat;
|
||||
}
|
||||
|
||||
.object-tools a:hover, .object-tools li:hover a {
|
||||
background: #5b80b2 url(../img/admin/tool-right_over.gif) 100% 0 no-repeat;
|
||||
background: #5b80b2 url(../../admin/img/admin/tool-right_over.gif) 100% 0 no-repeat;
|
||||
}
|
||||
|
||||
.object-tools a.viewsitelink, .object-tools a.golink {
|
||||
background: #999 url(../img/admin/tooltag-arrowright.gif) top right no-repeat;
|
||||
background: #999 url(../../admin/img/admin/tooltag-arrowright.gif) top right no-repeat;
|
||||
padding-right: 28px;
|
||||
}
|
||||
|
||||
.object-tools a.viewsitelink:hover, .object-tools a.golink:hover {
|
||||
background: #5b80b2 url(../img/admin/tooltag-arrowright_over.gif) top right no-repeat;
|
||||
background: #5b80b2 url(../../admin/img/admin/tooltag-arrowright_over.gif) top right no-repeat;
|
||||
}
|
||||
|
||||
.object-tools a.addlink {
|
||||
background: #999 url(../img/admin/tooltag-add.gif) top right no-repeat;
|
||||
background: #999 url(../../admin/img/admin/tooltag-add.gif) top right no-repeat;
|
||||
padding-right: 28px;
|
||||
}
|
||||
|
||||
.object-tools a.addlink:hover {
|
||||
background: #5b80b2 url(../img/admin/tooltag-add_over.gif) top right no-repeat;
|
||||
background: #5b80b2 url(../../admin/img/admin/tooltag-add_over.gif) top right no-repeat;
|
||||
}
|
||||
|
||||
/* OBJECT HISTORY */
|
||||
|
@ -764,7 +764,7 @@ table#change-history tbody th {
|
|||
}
|
||||
|
||||
#content-related .module h2 {
|
||||
background: #eee url(../img/admin/nav-bg.gif) bottom left repeat-x;
|
||||
background: #eee url(../../admin/img/admin/nav-bg.gif) bottom left repeat-x;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
|
@ -910,7 +910,7 @@ fieldset.collapsed h2, fieldset.collapsed {
|
|||
}
|
||||
|
||||
fieldset.collapsed h2 {
|
||||
background-image: url(../img/admin/nav-bg.gif);
|
||||
background-image: url(../../admin/img/admin/nav-bg.gif);
|
||||
background-position: bottom left;
|
||||
color: #999;
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ fieldset.monospace textarea {
|
|||
.submit-row {
|
||||
padding: 5px 7px;
|
||||
text-align: right;
|
||||
background: white url(../img/admin/nav-bg.gif) 0 100% repeat-x;
|
||||
background: white url(../../admin/img/admin/nav-bg.gif) 0 100% repeat-x;
|
||||
border: 1px solid #ccc;
|
||||
margin: 5px 0;
|
||||
overflow: hidden;
|
||||
|
@ -950,7 +950,7 @@ fieldset.monospace textarea {
|
|||
}
|
||||
|
||||
.submit-row .deletelink {
|
||||
background: url(../img/admin/icon_deletelink.gif) 0 50% no-repeat;
|
||||
background: url(../../admin/img/admin/icon_deletelink.gif) 0 50% no-repeat;
|
||||
padding-left: 14px;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ fieldset.monospace textarea {
|
|||
color: #666;
|
||||
padding: 3px 5px;
|
||||
font-size: 11px;
|
||||
background: #e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x;
|
||||
background: #e1e1e1 url(../../admin/img/admin/nav-bg.gif) top left repeat-x;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ fieldset.monospace textarea {
|
|||
color: #666;
|
||||
padding: 3px 5px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background: #e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x;
|
||||
background: #e1e1e1 url(../../admin/img/admin/nav-bg.gif) top left repeat-x;
|
||||
}
|
||||
|
||||
.inline-group .tabular tr.add-row td {
|
||||
|
@ -1113,7 +1113,7 @@ fieldset.monospace textarea {
|
|||
.inline-group ul.tools a.add,
|
||||
.inline-group div.add-row a,
|
||||
.inline-group .tabular tr.add-row td a {
|
||||
background: url(../img/admin/icon_addlink.gif) 0 50% no-repeat;
|
||||
background: url(../../admin/img/admin/icon_addlink.gif) 0 50% no-repeat;
|
||||
padding-left: 14px;
|
||||
font-size: 11px;
|
||||
outline: 0; /* Remove dotted border around link */
|
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 = 'AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADLy8tLy8vL3svLy1QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAy8vLBsvLywkAAAAATkZFS1xUVPqhn57/y8vL0gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJmVlQ/GxcXiy8vL88vLy4FdVlXzTkZF/2RdXP/Ly8vty8vLtMvLy5DLy8vty8vLxgAAAAAAAAAAAAAAAAAAAABORkUJTkZF4lNMS/+Lh4f/cWtq/05GRf9ORkX/Vk9O/3JtbP+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WBORkX2TkZFYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//+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