YK
Size: a a a
YK
AO
iS
vu
s
s
DT
s
iS
R
R
iS
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
R
В
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
R
R
A
R
S
def process_request(self, request):
ua_string = request.headers['User-Agent']
user_agent = parse(ua_string)
if '/go/' in request.path:
if user_agent.is_bot:
print('bot')
request.path = '/'
return redirect('confirm')
else:
print('not-bot')
request.path = reverse('go')
return redirect('/')
A