On Jul 12, 2016 4:27 AM, "VilleP" <pasone...@gmail.com> wrote:
>
> Hi guys!
>
> I've got a little problem with my url "generating". Everytime I try to run my testserver and move through pages, that I've linked there it goes like this:
>
> http://testserver.local/home #(this is totally fine)
> (click on another page)
> http://testserver.local/home/page1
> (click on another page besides home)
> http://testserver.local/home/page1/page2
> (if I click again to previous by clicking menu button it goes like this)
> http://testserver.local/home/page1/page2/page1
>
This is happening because your site is generating links using a short relative path (href='page1'). Are you generating URL paths using the Django methods such as reverse() and {% url %}?
> page1, etc. are examples here which helps me to present the problem.
>
> Any help for this one? I'll paste my urls.py and views.py below:
>
>
> from django.conf.urls import url
> from sivusto import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> url(r'^tekninen.html/$', views.tekninen, name='tekninen'), #(this would be page1)
> url(r'^johdon_tyokalut.html/$', views.johdon_tyokalut, name='johdon_tyokalut'), #(this would be page2)
> ]
Can you provide an example of a problematic {% url %} tag from your template, and the generated HTML on the browser for that same anchor?
Based on the urls.py files you posted, the behavior you describe shouldn't be possible. Is this behavior seen using the dev server, or using a production server like Apache?
-James