From 1a7034df66d5aefe85bbcd23c0970973c18cdc8c Mon Sep 17 00:00:00 2001 From: erjemin Date: Thu, 29 Jan 2026 22:51:12 +0300 Subject: [PATCH] =?UTF-8?q?mod:=20=D1=81=D0=BF=D1=80=D1=8F=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=20url=20=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=B2=20.env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 3 +++ etpgrf_site/etpgrf_site/settings.py | 4 ++++ etpgrf_site/etpgrf_site/urls.py | 5 +++-- public/static/robots.txt | 1 - 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index c389198..e3a09d3 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,9 @@ ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0 # Укажите здесь URL, по которому вы заходите на сайт (с протоколом и портом) CSRF_TRUSTED_ORIGINS=http://localhost:8000,http://127.0.0.1:8000,http://0.0.0.0:8000 +# URL для доступа к админке Django (можно сменить для безопасности, чтобы боты не могли её найти) +ADMIN_URL=admin/ + # Настройки достпа к пакетам в репозитории, чтобы wathtower мог проверять их свежесть и скачивать REPO_USER=xxxxx REPO_PASS=xxxxx diff --git a/etpgrf_site/etpgrf_site/settings.py b/etpgrf_site/etpgrf_site/settings.py index 26a6a7d..db39331 100644 --- a/etpgrf_site/etpgrf_site/settings.py +++ b/etpgrf_site/etpgrf_site/settings.py @@ -24,6 +24,10 @@ ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', 'localhost,127.0.0.1').split(',') # CSRF Trusted Origins (важно для работы через Nginx/Docker) CSRF_TRUSTED_ORIGINS = os.getenv('CSRF_TRUSTED_ORIGINS', 'http://localhost:8000,http://127.0.0.1:8000').split(',') +# URL админки (можно скрыть через .env) +# По умолчанию 'admin/' +ADMIN_URL = os.getenv('ADMIN_URL', 'admin/') + # Application definition diff --git a/etpgrf_site/etpgrf_site/urls.py b/etpgrf_site/etpgrf_site/urls.py index a2231b9..acd82ea 100644 --- a/etpgrf_site/etpgrf_site/urls.py +++ b/etpgrf_site/etpgrf_site/urls.py @@ -12,7 +12,9 @@ sitemaps = { } urlpatterns = [ - path('adm-in/', admin.site.urls), + # Админка по секретному URL + path(f'{settings.ADMIN_URL}', admin.site.urls), + path('', include('typograph.urls')), # Блог @@ -25,6 +27,5 @@ urlpatterns = [ path('/', blog_views.page_detail, name='page_detail'), ] -# Для отдачи медиафайлов в режиме разработки if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/public/static/robots.txt b/public/static/robots.txt index 3a9d5df..46fd3a7 100644 --- a/public/static/robots.txt +++ b/public/static/robots.txt @@ -1,6 +1,5 @@ User-agent: * Allow: / -Disallow: /adm-in/ Host: https://typograph.cube2.ru Sitemap: https://typograph.cube2.ru/sitemap.xml