Python Forum
Django serving wrong template at the wrong address with malformed urls.py (redactor a
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Django serving wrong template at the wrong address with malformed urls.py (redactor a
#3
I arrived at the solution by making three changes.

Firstly, I swapped the order of lines 8 and 9 in my parent urls.py so that it looks like this now:

from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
  
urlpatterns = [
   path('admin/', admin.site.urls),
   path('', include('redactors.urls')),
   path('', include('posts.urls')),
   path('', include('counters.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Next I pass in 'posts':posts, as part of the context inside the home function inside the redactors’ app views.py.

Thirdly I changed ‘home’ to ’’ inside the redactors app urls.py.

It now runs as intended.

ndc85430: Perhaps JavaScript is better suited to implement my feature however right now I am focused on learning Python and Django. Once I become competent enough in Django maybe I will take up some JavaScript courseware.
Reply


Messages In This Thread
RE: Django serving wrong template at the wrong address with malformed urls.py (redactor a - by Drone4four - Aug-17-2020, 01:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What am I doing wrong? Larz60+ 2 1,661 Apr-29-2022, 12:11 PM
Last Post: Larz60+
  BeautifulSoup not parsing other URLs giddyhead 0 1,202 Feb-23-2022, 05:35 PM
Last Post: giddyhead
  django - reset password template rwahdan 2 2,010 Dec-26-2021, 09:09 PM
Last Post: Jeff900
  what is wrong with my code? greenpine 0 1,350 Nov-08-2021, 10:01 PM
Last Post: greenpine
  Need logic on how to scrap 100K URLs goodmind 2 2,638 Jun-29-2020, 09:53 AM
Last Post: goodmind
  Don't know what went wrong Tejas 1 1,577 Jun-23-2020, 11:45 AM
Last Post: nuffink
  Wrong number of google results in a date range Val 0 1,874 Mar-15-2020, 02:29 PM
Last Post: Val
  What i do wrong? In response i get home page code aruzo 1 1,585 Feb-23-2020, 11:32 PM
Last Post: micseydel
  Why use HTML in Django Template ift38375 2 2,832 Dec-09-2019, 02:28 AM
Last Post: snippsat
  Scrape multiple urls LXML santdoyle 1 3,558 Oct-26-2019, 09:53 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020