Python Forum
Page not found (404) - Problem - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Page not found (404) - Problem (/thread-21364.html)



Page not found (404) - Problem - ronindev - Sep-26-2019

I started a project Learning_log. All going well till I started making pages.

It was opening alright in django.
------------------
In urls.py (following changes: include in 2nd line and path in 5th. line)

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

urlpatterns = [
path('admin/', admin.site.urls),
path(' ', include('learning_logs.urls')),
]
---------------
IN learning_log folder, new urls.py file:

"""Defines URL patterns for learning_logs."""

from django.urls import path

from . import views

app_name = 'learning_logs'
urlpatterns = [
# Home Page
path(' ', views.index, name='index'),
]
---------------
In views.py :

from django.shortcuts import render

# Create your views here.
def index(request):
	"""The home page for Learning Log."""
	return render(request, 'learning_logs/index.html')
---------------
Then in project folder learning_log, made new folder inside learning_logs called templates. Inside templates a learning_logs folder and finally a index.html page with following:

Output:
<p>Learning Log</p> <p> Learning Log helps you to keep track of your learning,for any topic you're learning about. </p>
---------------

It shows Page not found 404 error.....What to do ???
Anyone can advice...??