+ 1

Can't render my html in views.py

Everything was working fine, but now the all my views can't render the html page I don't know why, one of the example is below with the error. ERROR SAYS: NoReverseMatch at /wiki/HTML Reverse for 'edit' not found. 'edit' is not a valid view function or pattern name. URLS: urlpatterns = [ path("", views.index, name="index"), path("wiki/newpage", views.newpage, name="newpage"), # path("wiki/edit", views.edit, name="edit"), path("wiki/random", views.random, name="random"), path("wiki/<str:search>", views.search, name="search"), path("wiki/", views.find, name="find") ] VIEWS: def search(request, search): if search in util.list_entries(): html = md.markdown(util.get_entry(search)) return render(request, "encyclopedia/search.html", { "search": search, "html": html }) else: return render(request, "encyclopedia/error.html") Edit: I don’t recognise the problem, so you can get the idea of the whole project here -> https://github.com/adarsh-mamgain/Stock Stock is the project name and encyclopedia is the app I’m having problem with.

27th Sep 2020, 9:07 AM
Adarsh Mamgain
Adarsh Mamgain - avatar
2 Answers
+ 2
Your view.py must have a view named "edit" which must also have it urls properly set in the urls.py file
27th Sep 2020, 9:10 AM
Mirielle
Mirielle - avatar
+ 2
i tried again by deleting the “edit” in view and urls, still the same error. Mirielle[ InAcTiVe ]
27th Sep 2020, 9:15 AM
Adarsh Mamgain
Adarsh Mamgain - avatar