First of all, your regular expression in the url pattern is incorrect.
r'^$/(?P<tag>\w+)'
It says that you need to combine everything:
- ^ start of line
- $ to end of line
- having a template with a name that consists of words and numbers after the end of the line
Usually, after the end of one line, another line or EOF appears, and not the content (unless you use a multi-line regular expression and you don't need it here).
:
r'^/(?P<tag>\w+)$'
reslover URL.
, URL- :
http:
:
(r'^$', 'twingle.search.views.index')
query :
request.GET.get('query', '')
mysite.com/search/param_here
:
(r'^search/(?P<query>\w+)$', 'twingle.search.views.index'),
, \w ( , ), query.
url:
urlpatterns = patterns('twingle.search.views',
url(r'^$', 'index'),
url(r'^search/(?P<query>\w+)$', 'index'),
)
:
def index(request, query=None)
if not query:
query = request.GET.get('query', '')