Skip to content

Commit

Permalink
Merge pull request arachnys#615 from hartwork/serve-root-favicon.ico
Browse files Browse the repository at this point in the history
Serve /favicon.ico resembling current arachnys/img/icon_*x*.png files
  • Loading branch information
frankh authored May 10, 2018
2 parents 58b69f0 + 5bf70c9 commit 73bbe63
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/test_with_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -x
output_dir='test-results'
mkdir -p $output_dir

./manage.py collectstatic --no-input
TEMPLATE_DEBUG=True coverage run --source="./cabot/" manage.py test $@
status=$?

Expand Down
4 changes: 4 additions & 0 deletions cabot/cabotapp/tests/tests_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,10 @@ def test_public_page_with_public_service_with_url(self):
expected = '<a href="http://example.com/" title="http://example.com/" target="_blank">Public service with url</a>'
self.assertIn(expected, response.content)

def test_favicon_ico(self):
response = self.client.get('/favicon.ico')
self.assertEqual(response.status_code, 200)


class TestAPI(LocalTestCase):
def setUp(self):
Expand Down
Binary file added cabot/static/arachnys/img/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions cabot/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@

from django.contrib import admin
from django.views.generic.base import RedirectView
from django.views.static import serve
from django.shortcuts import redirect
from django.contrib.auth.views import login, logout, password_reset, password_reset_done, password_reset_confirm
admin.autodiscover()

from importlib import import_module
import logging
import os

logger = logging.getLogger(__name__)

Expand All @@ -55,6 +57,9 @@ def home_authentication_switcher(request, *args, **kwargs):
# for the password reset views
url('^', include('django.contrib.auth.urls')),

url(r'^(?P<path>favicon\.ico)$', serve, name='favicon',
kwargs={'document_root': os.path.join(settings.STATIC_ROOT, 'arachnys/img')}),

url(r'^$', view=home_authentication_switcher,
name='dashboard'),
url(r'^subscriptions/', view=subscriptions,
Expand Down

0 comments on commit 73bbe63

Please sign in to comment.