title: NameError: name 'index' is not defined
body: <p>I have started my first django project and having an issue with adding a view to my urlpatters.</p>
  
  <p><strong>project/first_app/views.py</strong></p>
  
  <pre><code>from django.shortcuts import render
  from django.http import HttpResponse
  
  # Create your views here.
  def index(request):
      return HttpResponse('test')
  </code></pre>
  
  <p><strong>project/project/urls.py</strong></p>
  
  <pre><code>from django.contrib import admin
  from django.urls import path
  from first_app import views
  
  urlpatterns = [
      path('admin/', admin.site.urls),
      path('', views.index, name=index),
  ]
  </code></pre>
  
  <p>This is throwing the below error in my server terminal</p>
  
  <pre><code>  File "/xxx/xxx/xxx/xxx/xxx/project/project/urls.py", line 22, in &lt;module&gt;
  path('first_app', views.index, name=index),
  NameError: name 'index' is not defined
  </code></pre>
  
  <p>I've played around with the path: <code>path('first_app'</code> quite a lot and can't seem to get it working.</p>