docker env vars, selenium docker simplified, favicon, settings clean
This commit is contained in:
23
app_urls/fetcher/middleware/favicon.py
Normal file
23
app_urls/fetcher/middleware/favicon.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
|
||||
'''
|
||||
class FaviconMiddleware(MiddlewareMixin):
|
||||
def process_response(self, request, response):
|
||||
if 'text/html' in response.get('Content-Type', '') and b'</head>' in response.content:
|
||||
icon_link = b'<link rel="icon" type="image/png" href="/static/img/mate-icon.png">\n'
|
||||
response.content = response.content.replace(b'</head>', icon_link + b'</head>')
|
||||
return response
|
||||
'''
|
||||
|
||||
class FaviconMiddleware(MiddlewareMixin):
|
||||
def process_response(self, request, response):
|
||||
if 'text/html' in response.get('Content-Type', '') and b'</head>' in response.content:
|
||||
icon_link = (
|
||||
b"<link rel='icon' href=\"data:image/svg+xml,"
|
||||
b"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'>"
|
||||
b"<text y='96' font-size='96'>\xf0\x9f\xa7\x89</text></svg>\">"
|
||||
b"\n"
|
||||
)
|
||||
# (UTF-8 encoded 🧉 = \xf0\x9f\xa7\x89 in bytes)
|
||||
response.content = response.content.replace(b'</head>', icon_link + b'</head>')
|
||||
return response
|
||||
@@ -3,12 +3,10 @@ from django.conf import settings
|
||||
from django.urls import reverse
|
||||
|
||||
EXEMPT_URLS = [
|
||||
# reverse('login'), # or the name of your login view
|
||||
reverse('admin:login'),
|
||||
reverse('admin:index'),
|
||||
# reverse('logout'), # optional
|
||||
'/admin/', # allow full access to admin
|
||||
settings.STATIC_URL, # allow static files
|
||||
'/admin/', # Allow full access to admin
|
||||
settings.STATIC_URL, # Allow static files
|
||||
# path('scheduler/', include('scheduler.urls')),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user