Ad
Serving Favicon.ico With Django. Why Does Settings.MEDIA_URL With Django.views.generic.simple.redirect_to Only Work On Dev Environment?
I found this solution for serving favicon.ico with django.
(r'^favicon\.ico$',
'django.views.generic.simple.redirect_to',
{'url': settings.MEDIA_URL+'images/favicon.ico'}),
I do not understand why it only works for the development server.
Going to /favicon.ico works on dev, doesn't with debug=False
.
It should redirect to /media/images/favicon.ico (served by apache), which does work if you access it directly.
Any ideas?
Ad
Answer
I'd recommend against serving the favicon with django unless you absolutely have to. Instead, putting a setting in your web server config that adds an alias pointing to the favicon.
For example, in apache:
Alias /favicon.ico /path/to/media_url/images/favicon.ico
Ad
source: stackoverflow.com
Related Questions
- → Django, code inside <script> tag doesn't work in a template
- → Uncaught ReferenceError: Parent is not defined
- → React - Django webpack config with dynamic 'output'
- → Put a Rendered Django Template in Json along with some other items
- → Implement shopify templates in django
- → Python Shopify API output formatted datetime string in django template
- → How to avoid being crawled/penalized by Google
- → Django: Identify the urls that provide duplicate content and set a canonical link
- → Shopify app: adding a new shipping address via webhook
- → Jquery Modal Confirmation on Django form submit for deletion of object
- → changing the size of an image with css
- → shopify_auth multi store session handling
- → How to use Shopify Python API RecurringApplicationCharge
Ad