Making a simple web scraper but stuck is this problem. At initial looks everything looks fine at my side as I've just started this project. I've checked the app mentioning and other common mistakes. Please point me out if I'm missing something.
I'm getting this error
NoReverseMatch at /
Reverse for 'search' with no arguments not found. 1 pattern(s) tried:
['$search/']
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.11.5
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'search' with no arguments not found. 1 pattern(s) tried:
['$search/']
Exception Location: C:\Program Files (x86)\Python36-32\lib\site-
packages\django\urls\resolvers.py in _reverse_with_prefix, line 497
Python Executable: C:\Program Files (x86)\Python36-32\python.exe
Python Version: 3.6.3
My urls.py is:
from django.conf.urls import url
from . import views
app_name = 'main'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^search/', views.search, name="search")
]
My Views.py is:
from __future__ import unicode_literals
from django.http import HttpResponse
from django.template import loader
def index(request):
template = loader.get_template('index.html')
return HttpResponse(template.render({}, request))
def search(request):
return HttpResponse('Hi There!')
And My form goes like this
<form action="{% url 'main:search' %}" method="POST" class="form-horizontal">
{% csrf_token %}
<div class="form-group">
<input type="url" id="input" class="form-control" name="iurl" placeholder="Enter Your Query" autocomplete="off" required><br>
<input type="submit" value="SUBMIT" class="btn btn-primary btn-lg">
</div>
</form>