title: Django URL mapping - NameError: name X is not defined
body: <p>[A similar question was asked, but not marked as answered, <a href="https://stackoverflow.com/questions/36823570/django-basics-myapp-mapping-in-myproject-myapp-is-not-defined">here</a>. I considered continuing that thread but the website told me I'm only supposed to post an answer, so it seems I have to start a new topic.] I'm trying to follow <a href="http://www.tutorialspoint.com/django/django_url_mapping.htm" rel="noreferrer">this</a> tutorial and I'm having problems with the URL mapping. Specifically with the part described as "So best practice is to create an “url.py” per application and to include it in our main projects url.py file". The relevant, I hope, part of the folder structure, which arose by following steps of the tutorial to the letter (if possible; usage of the 'patterns' module was impossible for example) and using Django 1.10 is the following:</p>
  
  <pre><code>myproject/
    myapp/
      urls.py
      views.py
    myproject/
      urls.py
  </code></pre>
  
  <p>The myproject/urls.py is as follows:</p>
  
  <pre><code>from django.conf.urls import include, url
  
  from django.contrib import admin
  admin.autodiscover()
  
  from myapp.views import hello
  
  urlpatterns = [
  url(r'^admin/', include(admin.site.urls)),
  url(r'^myapp/', include(myapp.urls)),
  ]
  </code></pre>
  
  <p>The myapp/urls.py is as follows:</p>
  
  <pre><code>from django.conf.urls import include, url
  
  urlpatterns = [
      url(r'^hello/', myapp.views.hello),
  ]
  </code></pre>
  
  <p>The myapp/views.py is as follows:</p>
  
  <pre><code>from django.shortcuts import render
  
  def hello(request):
     return render(request, "hello.html", {})
  </code></pre>
  
  <p>However, running 'python manage.py runserver' results in the following error:</p>
  
  <pre><code>url(r'^myapp/', include(myapp.urls)),
  NameError: name 'myapp' is not defined
  </code></pre>
  
  <p>INSTALLED_APPS in settings.py contains 'myapp'.</p>
  
  <p>I'd be greatful for any tips on how to deal with the NameError! [Or any tips whatsoever that anyone might consider to be helpful!]</p>