Answer the question
In order to leave comments, you need to log in
How to make the start page display from Tilda?
Good day to all,
1. I have a Django project. Tied to a domain.
2. I have a website built with Tilda.
3. The goal is that when I go to www.example.com, the start page with Tilda opens, but for www.example.com/admin, the Django admin panel remains.
Went the easy way first:
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.views.generic.base import RedirectView
from landing.views import IndexView, PoliticView, LicenseView
urlpatterns = [
# path("", IndexView.as_view(), name="maintenance-view"),
path("", RedirectView.as_view(url="http://EXAMPLE.tilda.ws/"), name="tilda-redirect"),
path("politic/", PoliticView.as_view(), name="politic-view"),
path("licence/", LicenseView.as_view(), name="licence-view"),
]
Answer the question
In order to leave comments, you need to log in
Did it like this:
class IndexView(TemplateView):
def get(self, request, *args, **kwargs):
req = get("http://example.tilda.ws")
cont = req.content.decode("utf-8")
cont = cont.replace('href="/', 'href="http://example.tilda.ws/')
return HttpResponse(content=cont, content_type=req.headers.get("Content-Type"), status=req.status_code)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question