On Friday, 13 September 2013 12:16:51 UTC+1, Christian Schulz wrote: > Hi, > > i'm wondering why after every click the url become longer. > > > In the project urls.py I have something like: > url(r'^reporting/', include('reporting.urls')), > > In the app urls.py something like: > url(r'total', views.total,name='total'), > > In the app reporting views I use render: > return render(request,'reporting/activity.html',.....) > > > So it works but I'm wondering why after click around between the reporting > views some time, I have a url like this. > /reporting/reporting/reporting/reporting/reporting/reporting/<http://localhost:8000/reporting/reporting/reporting/reporting/reporting/reporting/> > activity > > > So django append every time a /reporting to the url. Might be not perfect? > > Thanks > Christian > >
The error is certainly in your template, which you don't show. You are probably linking to a relative URL: `<a href="reporting/total">`, where you should have a leading slash: `<a href="/reporting/total">` However, you should not be using hard-coded URLs anyway. You should always use the url tag - eg `<a href="{% url "total" %}">` - to create URLs in a template. These calculated URLs will always be absolute. -- DR. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.