Search code examples
pythonhtmldjangodjango-viewsdjango-templates

'pages' is not a registered namespace


Trying to load a index in this ambient:

├── 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

And this is where the error happens (in the I'm here text [see in tree]):

            {% 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 %}

And the error is the one in the title.

I tried putting 'pages:index' instead of 'index' to try to go to the pages folder where the index is located. And this is the error that appeared: 'pages' is not a registered namespace'

This si the views.py:

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

Thanks in advance.


Solution

  • Include admin_material.urls in the core urls. path("", include('admin_material.urls')),