title: Python URL Not Found
body: <p>I am using <a href="https://ultimatedjango.com/learn-django/lessons/create-the-hello-world-web-app/?trim=yes" rel="nofollow noreferrer">this</a> Python tutorial but looks like the author hasn't updated it because the code is using deprecated Python code, specifically: </p>
  
  <pre><code>from django.conf.urls import patterns
  
      urlpatterns = patterns('',
          (r'^hello-world/$', index),
      )
  </code></pre>
  
  <p>I looked up Django documentation and other StackOverFlow questions but I am unable to resolve how I can use the current method.  This is what I have added to replace the above: </p>
  
  <pre><code>urlpatterns = [
      url(r'^hello-world$', hello),
  ]
  </code></pre>
  
  <p>And here is the full hello.py file: </p>
  
  <pre><code>import sys
  
  from django.conf import settings
  from django.conf.urls import url
  from django.http import HttpResponse
  from django.core.management import execute_from_command_line
  
  settings.configure(
      DEBUG=True,
      SECRET_KEY='thisisabadkeybutitwilldo',
      ROOT_URLCONF=sys.modules[__name__],
  )
  
  def index(request):
      return HttpResponse('Hello, World')
  
  import views
  
  urlpatterns = [
      url(r'^hello-world$', hello),
  ]
  
  if __name__ == "__main__":
      execute_from_command_line(sys.argv)
  </code></pre>
  
  <p>And this is the error message I get from Python: </p>
  
  <blockquote>
    <p>Using the URLconf defined in <strong>main</strong>, Django tried these URL
    patterns, in this order: ^$ [name='hello'] The current URL, hello,
    didn't match any of these.</p>
  </blockquote>
  
  <p>What am I doing wrong? </p>