Django App создает неправильный URL на рабочем сервере (общий Linux-сервер на A2 Hosting)

Мое приложение Django App корректно работает на localhost с использованием python manage.py runserver.

Когда я запускаю это приложение на общем сервере linux на сайте хостинга (A2 Hosting), работает только базовый url в корне домена: https://familyrecipes.de

Все остальные URL изменяются, скажем: https://familyrecipes.de/recipes до https://familyrecipes.de/familyrecipes.de/recipes

Что может добавить дополнительный 'familyrecipes.de' к url???

В файле views.py я вызываю отдельные представления следующим образом:

# for the index view

    return render(
        request,
        "FamilyRecipes/index.html",
        context=content)


# or for the recipes view

    return render(
        request,
        "FamilyRecipes/recipes.html",
        context=content)

etc.

Мой url.py:

import os
from django.contrib import admin
from django.urls import path, re_path
from django.conf.urls.static import static
from django.conf import settings
from . import views

app_name = 'FamilyRecipes'

urlpatterns = [
    re_path(r"^$", views.index, name="Home Page"),
    re_path(r"^recipes$", views.recipes, name="Recipes"),
    path('recipe/<int:id>/<str:flag>', views.singleRecipe, name="Print"),
    path('updateRecipe/<int:id>', views.updateRecipe, name="Update Recipe"),
    re_path(r"^toc$", views.toc, name="Recipe TOC"),
    path('dashboard', views.dashboard, name="Dashboard"),
    path('recipeScore/<int:user>/<int:recipe>/<int:score>',
         views.recipeScore, name="Recipe Score"),
    path('recipeNote/<int:user>/<int:recipe>/<str:noteStr>',
         views.recipeNote, name="Recipe Note"),
    path('deleteRecipeNote/<int:user>/<int:recipe>',
         views.deleteRecipeNote, name="Delete Note"),
    path("logout", views.logout, name="logout"),
    path('admin', admin.site.urls, name="Admin Home Page"),
]

on-linux-shared-hosting
urlpatterns += static(settings.STATIC_URL,
                      document_root=os.path.join(settings.BASE_DIR, 'static'))

Мой код header.html со ссылками меню:

    <nav id="navbar" class="main-nav navbar fixed-top navbar-expand-lg bg-light">
        <div class="container">
            <div class="row">
                <a class="navbar-brand" href="{% url 'Home Page' %}">
                    <h1 class="col-12 text-secondary">Family Recipes</h1>
                </a>
            </div>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#main_nav" aria-expanded="false" aria-label="Toggle navigation">
                <i class="fas fa-bars" aria-hidden="true"></i>
            </button>
            <div class="collapse navbar-collapse justify-content-end" id="main_nav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link active" aria-current="page" href="{% url 'Recipes' %}">Recipes</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'Update Recipe' 0 %}">New Recipe</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'Recipe TOC' %}">Index</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#">Help</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'Dashboard' %}">Dashboard</a>
                    </li>
                    {% if firstName.strip %}
                    <li class="nav-item">
                        <a class="nav-link logout" href="{% url 'logout' %}">
                            <i class="fas fa-sign-out-alt"></i>&nbsp;Logout<br>{{ firstName }}</a>
                    </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

Мой пассажир_wsgi/py

import os
import sys

import django.core.handlers.wsgi
from django.core.wsgi import get_wsgi_application

# Set up paths and environment variables
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'FamilyRecipes.settings'

# add your project directory to the sys.path
#project_home = '~/familyrecipes.de'
#if project_home not in sys.path:
#    sys.path.insert(0, project_home)

# Set script name for the PATH_INFO fix below
SCRIPT_NAME = os.getcwd()


class PassengerPathInfoFix(object):
    """
        Sets PATH_INFO from REQUEST_URI because Passenger doesn't provide it.
    """

    def __init__(self, app):
        self.app = app

    def __call__(self, environ, start_response):
        from urllib.parse import unquote
        environ['SCRIPT_NAME'] = SCRIPT_NAME
        request_uri = unquote(environ['REQUEST_URI'])
        script_name = unquote(environ.get('SCRIPT_NAME', ''))
        offset = request_uri.startswith(
            script_name) and len(environ['SCRIPT_NAME']) or 0
        environ['PATH_INFO'] = request_uri[offset:].split('?', 1)[0]
        return self.app(environ, start_response)

# Set the application
application = get_wsgi_application()
application = PassengerPathInfoFix(application)

Мой wsgi.py:

import os
from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'FamilyRecipes.settings')
application = get_wsgi_application()

Мой .htaccess

PassengerAppRoot "/yyyy/xxxx/familyrecipes.de"
PassengerBaseURI "/"
PassengerPython "/yyyy/xxxx/virtualenv/familyrecipes.de/3.9/bin/python"
PassengerAppLogFile "/yyyy/xxxx/familyrecipes.de/logs/webApp.log"
<IfModule Litespeed>
</IfModule>

Мой settings.py

Вернуться на верх