“pages”不是已注册的命名空间

问题描述 投票:0回答:1

尝试在此环境中加载索引:

├── admin_material
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── __init__.py
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-311.pyc
│   │   ├── admin.cpython-312.pyc
│   │   ├── apps.cpython-311.pyc
│   │   ├── apps.cpython-312.pyc
│   │   ├── forms.cpython-311.pyc
│   │   ├── __init__.cpython-311.pyc
│   │   ├── __init__.cpython-312.pyc
│   │   ├── models.cpython-311.pyc
│   │   ├── models.cpython-312.pyc
│   │   ├── tests.cpython-311.pyc
│   │   ├── urls.cpython-311.pyc
│   │   ├── utils.cpython-311.pyc
│   │   ├── utils.cpython-312.pyc
│   │   └── views.cpython-311.pyc
│   └── static
│   ├── templates
│   │   ├── accounts
│   │   │   ├── login.html
│   │   │   ├── password_change_done.html
│   │   │   ├── password_change.html
│   │   │   ├── password_reset_complete.html
│   │   │   ├── password_reset_confirm.html
│   │   │   ├── password_reset_done.html
│   │   │   ├── password_reset.html
│   │   │   └── register.html
│   │   ├── admin
│   │   │   ├── actions.html
│   │   │   ├── auth
│   │   │   │   └── user
│   │   │   │       ├── add_form.html
│   │   │   │       └── change_password.html
│   │   │   ├── change_form.html
│   │   │   ├── change_form_object_tools.html
│   │   │   ├── change_list.html
│   │   │   ├── change_list_object_tools.html
│   │   │   ├── change_list_results.html
│   │   │   ├── delete_confirmation.html
│   │   │   ├── delete_selected_confirmation.html
│   │   │   ├── edit_inline
│   │   │   │   ├── stacked.html
│   │   │   │   └── tabular.html
│   │   │   ├── filter.html
│   │   │   ├── includes
│   │   │   │   ├── fieldset.html
│   │   │   │   └── object_delete_summary.html
│   │   │   ├── index.html
│   │   │   ├── invalid_setup.html
│   │   │   ├── login.html
│   │   │   ├── object_history.html
│   │   │   ├── pagination.html
│   │   │   ├── search_form.html
│   │   │   └── submit_line.html
│   │   ├── includes
│   │   │   ├── fixed-plugin.html
│   │   │   ├── footer-fullscreen.html
│   │   │   ├── footer.html
│   │   │   ├── footer-rtl.html
│   │   │   ├── navigation-fullscreen.html
│   │   │   ├── navigation.html
│   │   │   ├── navigation-rtl.html
│   │   │   ├── scripts.html
│   │   │   ├── sidebar.html ------------------------------I'M HERE!!!!!!!!!!!!
│   │   │   └── sidebar-rtl.html
│   │   ├── layouts
│   │   │   ├── base-fullscreen.html
│   │   │   ├── base.html
│   │   │   └── base-rtl.html
│   │   ├── pages
│   │   │   ├── billing.html
│   │   │   ├── icons.html
│   │   │   ├── index.html
│   │   │   ├── map.html
│   │   │   ├── notifications.html
│   │   │   ├── profile.html
│   │   │   ├── rtl.html
│   │   │   ├── tables.html
│   │   │   ├── template.html
│   │   │   ├── typography.html
│   │   │   └── virtual-reality.html
│   │   └── registration
│   │       ├── logged_out.html
│   │       ├── password_change_done.html
│   │       └── password_change_form.html
│   ├── templatetags
│   │   ├── admin_material.py
│   │   ├── __init__.py
│   │   └── __pycache__
│   │       ├── admin_material.cpython-311.pyc
│   │       ├── admin_material.cpython-312.pyc
│   │       ├── __init__.cpython-311.pyc
│   │       └── __init__.cpython-312.pyc
│   ├── tests.py
│   ├── urls.py
│   ├── utils.py
│   └── views.py
├── charts
│   ├── admin.py
│   ├── __init__.py
│   ├── migration
│   │   └── __init__.py
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-311.pyc
│   │   ├── __init__.cpython-311.pyc
│   │   ├── models.cpython-311.pyc
│   │   ├── urls.cpython-311.pyc
│   │   └── views.cpython-311.pyc
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── db.sqlite3
├── home
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   ├── __init__.py
│   │   └── __pycache__
│   │       ├── __init__.cpython-311.pyc
│   │       └── __init__.cpython-312.pyc
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-311.pyc
│   │   ├── admin.cpython-312.pyc
│   │   ├── apps.cpython-311.pyc
│   │   ├── apps.cpython-312.pyc
│   │   ├── __init__.cpython-311.pyc
│   │   ├── __init__.cpython-312.pyc
│   │   ├── models.cpython-311.pyc
│   │   ├── models.cpython-312.pyc
│   │   ├── urls.cpython-311.pyc
│   │   ├── views.cpython-311.pyc
│   │   └── views.cpython-312.pyc
│   ├── tests.py
│   └── views.py
├── manage.py
├── securityv
│   ├── asgi.py
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-311.pyc
│   │   ├── __init__.cpython-312.pyc
│   │   ├── settings.cpython-311.pyc
│   │   ├── settings.cpython-312.pyc
│   │   ├── urls.cpython-311.pyc
│   │   ├── urls.cpython-312.pyc
│   │   ├── wsgi.cpython-311.pyc
│   │   └── wsgi.cpython-312.pyc
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── static
│   ├── background.jpg
│   ├── button57.css
│   ├── header.css
│   ├── index.css
│   ├── logforms.css
│   ├── logo.png
│   ├── profile.css
│   ├── profile.js
│   └── sidebar.css
└── templates
    ├── charts
    │   └── dashboard.html
    ├── includes
    │   └── custom-footer.html
    ├── landingpage.html
    ├── layouts
    │   ├── base-fullscreen.html
    │   ├── base.html
    │   └── base-rtl.html
    ├── pages
    │   └── profile.html
    └── registration
        ├── logged_out.html
        ├── login.html
        ├── password_reset_complete.html
        ├── password_reset_confirm.html
        ├── password_reset_done.html
        ├── password_reset_email.html
        └── password_reset_form.html

61 directories, 445 files

这就是错误发生的地方(在“我在这里”文本中[参见树]):

            {% if request.user.is_superuser %}
            <a href="{% url 'admin:index' %}" class="nav-link text-white {% if 'index' in segment %} active {% endif %}">
            {% else %}
            <a href="{% url 'index' %}" class="nav-link text-white {% if 'index' in segment %} active {% endif %}">
            {% endif %}

错误就是标题中的错误。

我尝试使用“pages:index”而不是“index”来尝试转到索引所在的页面文件夹。 这就是出现的错误:

'pages' is not a registered namespace'

这是views.py:

def index(request):
  return render(request, 'pages/index.html', { 'segment': 'index' })

提前致谢。

python html django django-views django-templates
1个回答
0
投票

在核心网址中包含 admin_material.urls。

path("", include('admin_material.urls')),

© www.soinside.com 2019 - 2024. All rights reserved.