Skip to main content

simple Django app which allows you to upload a image and it renders a wide variety for html link tags to display the favicon

Project description

django-favicon-plus

Django favicon plus is a simple django app which allows you to upload a image and it renders a wide variety for html link tags to display the favicon. These different tags are used for bookmark links on mobile devices or they appear if you favorite a website in your browser.

This version is a fork of the original version from arteria GmbH due to lack of maintenance.

How to use:

Install django-favicon using PIP.

pip install django-favicon-plus-reloaded
pip install git+https://edugit.org/AlekSIS/libs/django-favicon-plus.git

Add app to INSTALLED_APPS List in your settings.py file, make sure sites-app is also installed, a URL is specified in the admin backend and you specify your site in settings.py with SITE_ID = <your-site-id-here>.

INSTALLED_APPS = (
    ...
    'django.contrib.sites',
    ...
    'favicon',
    ...
)

The default FAVICON_CONFIG look like this, if you want something else you can define it in your settings.py. The key of the dictionary is the value for the rel attribute of the link tag, while the list in the value are the sizes for the size attribute and the image resizing.

FAVICON_CONFIG = {
    'shortcut icon': [16 ,32 ,48 ,128, 192],
    'touch-icon': [196],
    'icon': [196],
    'apple-touch-icon': [57, 72, 114, 144, 180],
    'apple-touch-icon-precomposed': [57, 72, 76, 114, 120, 144, 152,180],
}

Please make sure you have specified a MEDIA_URL in settings.py and your root urlconf looks like this:

urlpatterns = [
    path('admin/', admin.site.urls),
    ...,
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

You can also provide a FAVICON_PATH in your settings.py to specify the folder name of your favicon folder. The default is favicon

Upload an image in the admin backend --> all the size will be created, its best to take a larger base favicon.

Use the templatetag in your base.html

{% load favtags %}

{% place_favicon %}

this will create:

<link rel="apple-touch-icon-precomposed" size ="180x180" href="/media/favicon/fav-180.png"/>
<link rel="apple-touch-icon-precomposed" size ="152x152" href="/media/favicon/fav-152.png"/>
<link rel="apple-touch-icon-precomposed" size ="144x144" href="/media/favicon/fav-144.png"/>
<link rel="apple-touch-icon-precomposed" size ="120x120" href="/media/favicon/fav-120.png"/>
<link rel="apple-touch-icon-precomposed" size ="114x114" href="/media/favicon/fav-114.png"/>
<link rel="apple-touch-icon-precomposed" size ="76x76" href="/media/favicon/fav-76.png"/>
<link rel="apple-touch-icon-precomposed" size ="72x72" href="/media/favicon/fav-72.png"/>
<link rel="apple-touch-icon-precomposed" size ="57x57" href="/media/favicon/fav-57.png"/>
<link rel="apple-touch-icon" size ="180x180" href="/media/favicon/fav-180_5l5PyO1.png"/>
<link rel="apple-touch-icon" size ="144x144" href="/media/favicon/fav-144_5A8THfC.png"/>
<link rel="apple-touch-icon" size ="114x114" href="/media/favicon/fav-114_GqBGFXA.png"/>
<link rel="apple-touch-icon" size ="72x72" href="/media/favicon/fav-72_UoWu9ik.png"/>
<link rel="apple-touch-icon" size ="57x57" href="/media/favicon/fav-57_sfX3XoJ.png"/>
<link rel="touch-icon" size ="192x192" href="/media/favicon/fav-192.png"/>
<link rel="shortcut icon" size ="192x192" href="/media/favicon/fav-192_rD0bCKr.png"/>
<link rel="shortcut icon" size ="128x128" href="/media/favicon/fav-128.png"/>
<link rel="shortcut icon" size ="48x48" href="/media/favicon/fav-48.png"/>
<link rel="shortcut icon" size ="32x32" href="/media/favicon/fav-32.png"/>
<link rel="shortcut icon" size ="16x16" href="/media/favicon/fav-16.png"/>
<link rel="icon" size ="192x192" href="/media/favicon/fav-192_Gw5Uu1M.png"/>
<link rel="shortcut icon" size ="32x32" href="/media/favicon/fav-32.png"/>

Management

You can upload multiple images, but only one is set as favicon and used.

Contribution

If you want to contribute something send an MR.

Source

Based on

Favicon Cheat Sheet on github

Favicon

16x16 .ico or better .png

<link rel="shortcut icon" href="/images/favicon.png" />

apple-touch-icon(-precomposed)

57x57, 72x72, 114x114, and 144x144 highest resolution for ipad retina 144x144.png precomposed(=iOS won’t add any effects to the icon)

<link rel="apple-touch-icon" sizes="144x144" href="/images/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="114x114" href="/images/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="57x57" href="/images/apple-touch-icon-57x57.png">

<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/images/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/images/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="/images/apple-touch-icon-57x57.png">

Android versions 1.5 and 1.6 will read the second tag (with "-precomposed"), and versions 2.1 and newer will read the first tag.

Google's specifications say that you should use 48x48 pixel PNGs, but you can use a large image (128x128), like Google does for its own apps.

https://mathiasbynens.be/notes/touch-icons

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-favicon-plus-reloaded-1.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-favicon-plus-reloaded-1.0.1.tar.gz.

File metadata

  • Download URL: django-favicon-plus-reloaded-1.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for django-favicon-plus-reloaded-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ee48b9a86ee20e5285216dc76c69cc6e8bcdcb1ea83c2585785dff7a4eebfc7b
MD5 34842a034d886a7e2f65b1efb8a294f7
BLAKE2b-256 c4e800fa36067585b19bd4e391c80e8347844eaf15b0d0afc76b9305889b4bee

See more details on using hashes here.

File details

Details for the file django_favicon_plus_reloaded-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: django_favicon_plus_reloaded-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for django_favicon_plus_reloaded-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d796bb994aa648a1d9c8276674a4de4e6af3ef2583dcd4d45495b4d3df85e283
MD5 a9c4e283c90ceb45a09d9147f56347a2
BLAKE2b-256 fa78c160d0268dbed6b08023bcb4c6d81a0fff3778b3cb85e92c79b583d8274a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page