Hi Everyone,
I need some guidance / corrections to my code.
I hosted a demo site on pythonanywhere.com and to test the initial
pages I wrote some test code.
Good news, put in 10 hrs, tried so many suggestion given on the net,
yet non worked. So finally mailing the list.
Objective : display main page with multiple links to other pages. Use
jQuery plugins, click the link on main page and open other pages.
The following path and pages are posted below.
Thanks
Nitin Chandra
ERROR
When I click on 'Table' link on 'home' page, the following error is displayed
http://selftech.pythonanywhere.com/table.html
Page not found (404)
Request Method:GET
Request URL:http://selftech.pythonanywhere.com/table.html
Using the URLconf defined in eduinfra.urls, Django tried these URL
patterns, in this order:
admin/
[name='home.html']
The current path, table.html, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a
standard 404 page.
+++
/home/selfTech/edu/tech/
__init__.py
admin.py
apps.py
models.py
tests.py
urls.py
views.py
/home/selfTech/edu/tech/templates/
base.html
home.html
table.html
***
our 'base.html' code below (test code, gets rendered correctly)
Navbar
Home (current)
Link
Table
Disabled
Search
*
home.html
{% extends 'base.html' %}
{% block content%}
Hello TEAM :)
{% endblock %}
***
table.html (gives ERROR 404)
Name
*
/home/selfTech/edu/tech/
urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('table/', views.table, name='table') ## various combo did not work
# path (' ', views.table, name='table') ## nope
# path (' ', views.table, name='table.html') # nope
]
*///
views.py
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def home (request): /// correctly renders
return render (request, "home.html",{})
def table (request): gives error
return HttpResponse ('This is a test Page')
# Tried the below code, nada
# return render (request, "table.html",{})
*\
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor