Sunday, November 26, 2017

Re: How to define a url that does not belong to any app?

SOLVED. Looks like I've done a silly mistake. Thanks for your answers though.

 Mistake was to write href="learnmore.html" in home page html. I changed this to href="{% url 'learnmore' %}, learnmore is the name of the view function of learnmore page.

26 Kasım 2017 Pazar 02:00:25 UTC+3 tarihinde Kubilay Yazoğlu yazdı:
Hi there. I have only one week of experience in Django, some things aren't clear to me yet.

I want to create a page where users can access by clicking on a button in homepage.
Since this page contains plain text and there is no functionality in it, it does not have be in any of the apps. But since I had to write its view function in somewhere, I've written it in the same view file of homepage (That's my thought. Correct me if I'm wrong)

First question is, where to define its view function? As I said I've defined it in the same view file of homepage. Not sure if that's the right way.
Secondly, how to define its url? I tried the following code but it does not work. I get this error when I click on the button in homepage: The current URL, learnmore.html, didn't match any of these.

url(r'^learnmore/$', learnmore_view)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5f389587-6330-439a-ac4b-8fab3848df5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment