Questions tagged [url-pattern]

The URL-pattern element of servlet-mapping or filter-mapping associates a filter or servlet with a set of URLs. When using this tag on implementation heavy questions - tag the code language the implementation is written in.

379 questions
7
votes
3 answers

Why can't I get my static dir to work with django 1.3?

This problem is very simple, but I just can't figure it out added to my urlpatterns url(r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/user/www/site/static'}) where my main.css is :…
Derek
  • 11,980
  • 26
  • 103
  • 162
7
votes
4 answers

django - regex for optional url parameters

I have a view in django that can accept a number of different filter parameters, but they are all optional. If I have 6 optional filters, do I really have to write urls for every combination of the 6 or is there a way to define what parts of the…
imns
  • 4,996
  • 11
  • 57
  • 80
7
votes
1 answer

Servlet mapping with multiple (two) wildcards separated by slash

I am trying to map a servlet pattern that matches both /server/abcDef/1432124/adfadfasdfa and /server/abcDef/abcd/12345 The values '1432124' and 'abcd' are not fixed and could be a multitude of values. So essentially I need to match against…
Sai
  • 3,819
  • 1
  • 25
  • 28
6
votes
2 answers

how to solve Django POST URL error of APPEND_SLASH

I'm trying get my form POST data onto next page but getting the error You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your…
Tabraiz Yasin
  • 65
  • 1
  • 5
6
votes
1 answer

decorator() got an unexpected keyword argument

I have this error on Django view: TypeError at /web/host/1/ decorator() got an unexpected keyword argument 'host_id' Request Method: GET Request URL: http://127.0.0.1:8000/web/host/1/edit Django Version: 1.10.4 Exception Type: TypeError Exception…
Zhang Ligao
  • 147
  • 1
  • 2
  • 10
6
votes
2 answers

Is there a standard way of replacing urlpatterns with view decorators in django?

I've developed my own, but it seems like it's a great enough thing that someone else probably thought of it first and did a better job ;) The goal is to be able to write, in your myapp/views.py router =…
Jared Forsyth
  • 12,808
  • 7
  • 45
  • 54
5
votes
1 answer

differenct between / and /* in servlet url match pattern

Possible Duplicate: Servlet mapping / vs /* What is the difference of '/' and '/*' in servlet url mapping? Since I am reading the book spring in action,and I found these words: Next we must indicate what URLs will be handled by the …
hguser
  • 35,079
  • 54
  • 159
  • 293
5
votes
1 answer

In Django, how to find out what URL pattern matched for a request?

I'm working on an old Django project with a lot of URL patterns. Sometimes, it's not clear for me which view was run by the dispatcher. Is there any way to see what URL pattern matched for a particular request in Django?
planetp
  • 14,248
  • 20
  • 86
  • 160
5
votes
2 answers

Spring MVC test - Injecting a mock repository when ever the integration test requires a specific type

I have written a web application using spring mvc 3. It provides a single endpoint that returns JSON. I did having it running successfully using url paramters but now I need to change this to use path variables instead. I changed my…
Jeremy
  • 3,418
  • 2
  • 32
  • 42
5
votes
2 answers

Cannot make REST call with url-pattern other than /*

I'm trying to do a simple REST Web Application using Tomcat 7, Apache Wink, and the Jackson JSON Processor, but seem to be hitting a wall. If I look in my web.xml file, I see:
gordysc
  • 234
  • 1
  • 4
  • 22
4
votes
1 answer

How to have nested url namespaces with a dynamic first part in Django

I have an application which is centered around rooms. These rooms have members who can post content in them. The way I thought of having the url patterns would be something like this # global urls.py (r'^g/',…
elbear
  • 769
  • 8
  • 16
4
votes
2 answers

how to properly redirect from one app to another app in django

i am a beginner to Django and i am unable to properly handle redirects from one app to another. I have 2 apps Accounts, Dashboard. Accounts Handles login and registration of AuthUser. Dashboard handles other functionality like Fileupload So far, I…
Tayyab
  • 99
  • 2
  • 8
4
votes
1 answer

Spring newbie: The url-pattern for my DispatcherServlet seems to 'override' the welcome-file

I am using Spring to render my JSPs, and the url-pattern for my DispatcherServlet is "/". This seems to be making it so that the welcome-file-list is never considered. I would actually like DispatcherServlet to handle everything except "/". However,…
Hamy
  • 20,662
  • 15
  • 74
  • 102
4
votes
4 answers

Django: URL pattern translation with gettext

In some Django applications I encountered URL patterns with gettext such as: from django.utils.translation import ugettext as _ urlpatterns = patterns('', ... url(r'^%s$' % _('about/'), about, name='about'), ... ) At first, it seemed…
onurmatik
  • 5,105
  • 7
  • 42
  • 67
4
votes
2 answers

How do I make this regex URL pattern work in Django 2

I need to make a URL pattern which could work with this URL: mysite.com/blog/12/بلاگ-مثال It contains utf-8 characters so I tried using \X: re_path(r'^blog/?P[\d+]+/(?P[\X.*]+)/$', views.single_blog, name='single_blog') But it…
Ghasem
  • 14,455
  • 21
  • 138
  • 171
1 2
3
25 26