title: How to solve NoReverseMatch error in django
body: <p>I am new to django.I want upload the file in django web page.When I'm executing the code it shows the following error.</p>
  
  <pre><code>NoReverseMatch at /index/
  Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
  </code></pre>
  
  <p>Please help me to print the csv results on the table by without saving the csv_file on db and correct my code if there is any error  </p>
  
  <p><strong>Main urls.py</strong></p>
  
  <pre><code> urlpatterns = patterns('',
  
          url(r'^admin/', include(admin.site.urls)),
  
          url(r'^',include('myapp.urls',namespace='myapp')),
      )
  
      if settings.DEBUG:
               urlpatterns+=static(settings.STATIC_URL,document_root=settings.STATIC_ROOT)
               urlpatterns+=static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
  </code></pre>
  
  <p><strong>myapp.urls</strong></p>
  
  <pre><code>from django.conf.urls import url, include
  from . import views
  
  urlpatterns = [
      url(r'^index/', views.upload_csv,name='upload_csv'),
  
  ]
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>from django.shortcuts import render
  from django.conf import settings
  from django.http import HttpResponseRedirect
  from django.contrib import messages
  import csv
  from django.core.urlresolvers import reverse
  import logging
  
  def upload_csv(request):
  
      data = {}
  
      if "GET" == request.method:
          return render(request, "myapp/index.html", data)
  
      # if not GET, then proceed
      try:
          csv_file = request.FILES["csv_file"]
          if not csv_file.name.endswith('.csv'):
              c=messages.error(request,'File is not CSV type')
              return HttpResponseRedirect(reverse("myapp:index",{"c":c}))
  
          #if file is too large, return
          if csv_file.multiple_chunks():
              messages.error(request,"Uploaded file is too big (%.2f MB)." % (csv_file.size/(1000*1000),))
              return HttpResponseRedirect(reverse("myapp:index"))
  
          file_data = csv_file.read().decode("utf-8")
          rows=[]
          lines = file_data.split("\n")
          for line in lines:
              fields = line.split(",")
              data_dict = {}
              data_dict["GSTIN/UIN"] = fields[0]
              data_dict["INV NO"] = fields[1]
              data_dict["INV-DATE"] = fields[2]
              data_dict["Taxable value"] = fields[3]
              try:
                  form = EventsForm(data_dict)
                  if form.is_valid():
                      form.save()
                  else:
                         logging.getLogger("error_logger").error(form.errors.as_json())
              except Exception as e:
                  logging.getLogger("error_logger").error(repr(e))
                  pass
              rows.append(line)
  
      except Exception as e:
          logging.getLogger("error_logger").error("Unable to upload file. "+repr(e))
          messages.error(request,"Unable to upload file. "+repr(e))
      variables={}
      variables['lines'] = rows
  
      return HttpResponseRedirect(reverse("myapp:index",variables))
      #return render(request,"myapp/index.html",variables)
  </code></pre>
  
  <p><strong>html</strong></p>
  
  <pre><code>&lt;!doctype&gt;
  &lt;html&gt;
    &lt;body&gt;
      &lt;div class="container" style="margin-top:90px;"&gt;
        &lt;form action="{% url 'myapp:index' %}" method="post" enctype="multipart/form-data"&gt;
        {% csrf_token %}
        &lt;div class="row"&gt;
          &lt;label for="fileupload" class="btn btn-primary  col-md-2 col-sm-4 uploadBtn" &gt;Upload GSTR 2A&lt;/label&gt;&lt;br&gt;
          &lt;input type="file" class="fileupload" id="fileupload" required="True"&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  
    &lt;table&gt;
      {% for line in lines %}
      &lt;tr&gt;&lt;td&gt;{{ line.0 }}&lt;/td&gt;&lt;td&gt;{{ line.1 }}&lt;/td&gt;&lt;/tr&gt;
      {% endfor %}
    &lt;/table&gt; 
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>