Reputation: 11
I started a Django project and went through the regular setup process: I used the "startproject" command to create a project named "social_clone_project", and I used "startapp" to create an app named "accounts". Then I created a "views.py" file and set up the "urls.py" file. Here's what it looks like:
from django.contrib import admin
from django.urls import path, include, re_path
from . import views
urlpatterns = [
re_path(r'^$', views.HomePage.as_view(), name='home'),
path("admin/", admin.site.urls),
]
Recently, I switched to Ubuntu Debian with the sublime-text editor. I'm new to the Ubuntu OS, and whenever I run the "runserver" command, the default "Congratulations!" page loads instead of my home page. I've created an "index.html" file, which is supposed to load as the home page, but it's not working. Can someone help me solve this issue?
Upvotes: 1
Views: 55
Reputation: 850
I think the problem is in your url regex so just change your code as follows :
from django.contrib import admin
from django.urls import path, include, re_path
from . import views
urlpatterns = [
path('', views.HomePage.as_view(), name='home'),
path("admin/", admin.site.urls),
]
Upvotes: 0