9
9
95506682021-03-31 18:53:12
Django
9550668, 2021-03-31 18:53:12

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"),
]

But it has one problem:
the line appears in the address bar of the browser: EXAMPLE.tilda.ws , and I would like to leave www.example.com

What is the best way to implement a solution to this issue?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
9
9550668, 2021-03-31
@9550668

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)

In the second part, I change the internal link to css and js files to the full path.
Is this the right way? It seems to me that it is too clumsy.

M
maksam07, 2021-04-11
@maksam07

What prevents on the main page just to make the frame 100%x100% and specify the tilde domain in the search?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question