Django doesn't go through my urls

I’m new to Django and I’m facing a problem that I can’t solve despit my research… I’v already made small django projects without this error but since I reformat my computer (I can’t see the link but that’s context!) i’m having this problem.

So when I’m running (runserver) a django project this is what my browser shows me despite others urls in my project

I’v tried with an almost empty project but a least one more url and still have the same page.

urls.py in the main file (src/mynotes/urls.py):

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path(‘index/’, include(‘dbnotes.urls’)),
path(‘admin/’, admin.site.urls),
]

settings.py in the main project (src/mynotes/settings.py):

INSTALLED_APPS = [
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘dbnotes’
]

urls.py in the app (src/dbnotes/urls.py):

from django.urls import path
from . import views

urlpatterns = [
path(“”, views.homepage, name=“homepage”),
]

views.py in the app (src/dbnotes/views.py):

from django.http import HttpResponse

def homepage(request):
return HttpResponse(“Hello, world. You’re at the polls index.”)

Even stranger, when i change “path(‘admin/’, admin.site.urls)” I still get the admin page with the same route. Even if i change ‘admin/’ or admin.site.urls.

It looks like my local server display an over empty django project but in the error page it’s written “mynotes.urls” as the url location which is the good folder.

I’m working with a virtual environment.

I’m lost as it’s the first time i got this issue despite having created ohter (small) django projects!

If anyone has an idea that would be great! Thank you!

I found a topic related to my problem but without an anwer : Django doesn’t see urls.py

Given the symptoms you’re describing here, my first reaction is that you’re not running what you think you’re running.

It could be anything at this point - including an old version of runserver that is still running.

1 Like

Are you forgetting a trailing slash? In the image, you are making a request to /index. In the code, your path is defined /index/

Hi and thank you for your answer. Yes I agree, even more with the fact that when I simply delete “admin.site.urls” in the main urls.py the admin page still load as if I didn’t change anything.

But when I execute python “manage.py runserver” it’s written “Starting development server at http://127.0.0.1:8000/” as it should, so I really can’t be wrong on the url of the local host as I just click on it.

Do you know how I can check if an old version of runserver that is still running?

Hi, I tried to change it but it didn’t change the result.

I just tried to change the port with “python manage.py runserver 8080” but it didn’t change anything.

What operating system are you using? How you check to see what processes are running depends upon that. (e.g. Task Manager in Windows, the ps command in *nix-style systems, etc.)

I’m on windows 11 if that’s the question

Yes, so Task Manager is the easiest tool to use to see what processes are running.

So… I think I found the solution and it’s actually really disappointing. For some reason VSCode wasn’t editing anymore my files. I was modifying the project in VS but the actual files were not changing. I don’t know what to say ^^. Anyway thank you very much for your time

The topic can be closed

1 Like

Hi, How did you then edit your files without VScode, did you use another IDE?

Man I was going crazy… This is so stupid. Thanks for the hint!

please could you explain what to do iam facing the same problem i dont know how to solve it everytime i try different urs it keeps showing me the same django welcome page