Django is rendered blank pages after updating path to re_path

Viewed 28

Im new to Django but after solving the orginal issues and changing path to re_path in all my URL files Django now starts the server with no issues. The URLs load but all pages are blank except the home page. `

from django.urls import re_path
from django.conf.urls import include
from django.contrib import admin
#from django.urls import path
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
re_path('admin/', admin.site.urls),
re_path('', include('home.urls')),
re_path("users/", include("django.contrib.auth.urls")), 
re_path("users/", include("users.urls")),  
re_path("accounts/", include("accounts.urls")), 

My console shows no errors so I am unsure what I am doing wrong. `

1 Answers

The fix was done by updating all url.py files. 1st Remove

from django.conf.urls import url

replace with

from django.urls import path

if any paths start with url simply change to path for example

 url('posts/',views.posts, name = 'posts'),

would become

 path('posts/',views.posts, name = 'posts'),

save the files and rerun the server.

Related