Error 404 - HTML page not rendering for other apps than main application

Hello everyone!

So I’ve created several apps in my Django project and I have one main app called main_app.

The other apps are called profile_app, settings_app, messages_app.

The issue:

The issues that I have is that whenever I try to run a certain view function from e.g profile_app in main_app using the app namespace and URL name (e.g profilepage_app:“profile-redirect”), I receive a 404 error stating “Page not found”.

I have done the following:

  • Registret all apps.
  • Linked the file in my settings URL.
  • Tried to create a test view function inside the main_app and it works perfectly, but the same function does not work in the profile_app.
  • Created another test app in order to see if I still have the same issue (I did).

So the problem is that whatever link from all apps (except main_app) that I try to display in the browser generats the “Page not found”-error.

My questions:

  1. Why does this happen?
  2. How can I resolve this issue?
  3. Has this something to do with my settings file?

The error:

My view:

from django.conf import settings
from django.shortcuts import render, redirect
from django.views.generic import View

from profile_app.forms import *
from profile_app.models import *
from messages_app.models import Message

user = settings.AUTH_USER_MODEL
# Create your views here.

## Redirect to user profile from the navbar

class ProfilePageView(View):
    model = ProfilepageMember
    template_name = "profile_app/profilepage.html"
    def get(self, request, user_name):
        user_related_data = ProfilepageMember.objects.filter(member__username = user_name)
        context = {"user_related_data": user_related_data}
        return render(request, self.template_name, context)


URL configuration for bodyswap_project project.

The `urlpatterns` list routes URLs to views. For more information please see:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path("", include("auth_app.urls")),
    path("", include("main_app.urls")),
    path("", include("profile_app.urls")),
    path("", include("messages_app.urls")),
    path("", include("settings_app.urls")),


Django settings for body project.

Generated by 'django-admin startproject' using Django 4.2.

For more information on this file, see

For the full list of settings and their values, see

from pathlib import Path
import os
from dotenv import load_dotenv

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv("SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv("DEBUG")


# HTTPS settings

# Set this to True in production to avoid transmitting the CSRF cookie over HTTP accidentally.
# Set this to True in production to avoid transmitting the CSRF cookie over HTTP accidentally.
# Change to True in production

# HSTS settings

# SECURE_HSTS_SECONDS = 31536000  # 1 year

# Email settings for the contact form
# Used only during development

EMAIL_HOST = os.getenv("EMAIL_HOST")
EMAIL_PORT = os.getenv("EMAIL_PORT")

# Application definition


    # Installed apps


ROOT_URLCONF = 'body.urls'

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

WSGI_APPLICATION = 'body.wsgi.application'

# Database

    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',

# Password validation

        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',

# Internationalization



USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)

STATIC_URL = 'static/'

    BASE_DIR / "static"

# Default primary key field type

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# This is set when creating a custom user model.
AUTH_USER_MODEL = 'main_app.Member'

I appreciate all help.

The fact that I’m not seeing a path of profilsida in your urls in the error message leads me to believe you might have something wrong with your root file. Please post the file that is referenced by your file.

Hello Sir!

I have now uploaded the entire settings file.

It’s not the settings file that I need to see. I need to see the file that is referenced by your settings file.

Sorry, I exchanged the files. But the URL is not uploaded.

This is wrong. The first parameter in the path needs to be the portion of the path to match, in order for the dispatcher to search the urls defined in the included files. Each one of those entries must be unique and should represent the app to be searched.

In other words, the first entry might look something like this:
path("auth/", include('auth_app.urls')),
(what that first parameter is, is up to you.)

All of those entries need to be distinguished from the rest.

1 Like

Thank you! I didn’t know that at all. The codes are running now :smiley: