title: Django - NameError: name 'app1' is not defined
body: <p>I have just set up virtualenv and then created a new app, called "app1", under a new project, "devp1".  I have edited the files as the following:</p>
  
  <p>views.py in in "app1" dir</p>
  
  <pre><code>from django.shortcuts import render
  from django.http import HttpResponse
  # Create your views here.
  
  def home(request):
      return HttpResponse("wow my first page")
  </code></pre>
  
  <p>settings.py in "devp1" dir</p>
  
  <pre><code>INSTALLED_APPS = [
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'app1',
  ]
  </code></pre>
  
  <p>url.py in "devp1" dir</p>
  
  <pre><code>urlpatterns = [
  url(r'^admin/', admin.site.urls),
  url(r'','app1.views.home'),
  ]
  </code></pre>
  
  <p>However, when I run the server, I receiving the following error, I have not found why it is not able to see "app1".</p>
  
  <pre><code>    Unhandled exception in thread started by &lt;function check_errors.&lt;locals&gt;.wrapper at 0x7f7ab830b400&gt;
  Traceback (most recent call last):
    File "/home/usr1/dev/lib/python3.4/site-packages/django/utils/autoreload.py", line 227, in wrapper
      fn(*args, **kwargs)
    File "/home/usr1/dev/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
      self.check(display_num_errors=True)
    File "/home/usr1/dev/lib/python3.4/site-packages/django/core/management/base.py", line 359, in check
      include_deployment_checks=include_deployment_checks,
    File "/home/usr1/dev/lib/python3.4/site-packages/django/core/management/base.py", line 346, in _run_checks
      return checks.run_checks(**kwargs)
    File "/home/usr1/dev/lib/python3.4/site-packages/django/core/checks/registry.py", line 81, in run_checks
      new_errors = check(app_configs=app_configs)
    File "/home/usr1/dev/lib/python3.4/site-packages/django/core/checks/urls.py", line 16, in check_url_config
      return check_resolver(resolver)
    File "/home/usr1/dev/lib/python3.4/site-packages/django/core/checks/urls.py", line 26, in check_resolver
      return check_method()
    File "/home/usr1/dev/lib/python3.4/site-packages/django/urls/resolvers.py", line 254, in check
      for pattern in self.url_patterns:
    File "/home/usr1/dev/lib/python3.4/site-packages/django/utils/functional.py", line 35, in __get__
      res = instance.__dict__[self.name] = self.func(instance)
    File "/home/usr1/dev/lib/python3.4/site-packages/django/urls/resolvers.py", line 405, in url_patterns
      patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
    File "/home/usr1/dev/lib/python3.4/site-packages/django/utils/functional.py", line 35, in __get__
      res = instance.__dict__[self.name] = self.func(instance)
    File "/home/usr1/dev/lib/python3.4/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
      return import_module(self.urlconf_name)
    File "/home/usr1/dev/lib64/python3.4/importlib/__init__.py", line 109, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "&lt;frozen importlib._bootstrap&gt;", line 2254, in _gcd_import
    File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1200, in _load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1129, in _exec
    File "&lt;frozen importlib._bootstrap&gt;", line 1471, in exec_module
    File "&lt;frozen importlib._bootstrap&gt;", line 321, in _call_with_frames_removed
    File "/home/usr1/dev/devp1/devp1/urls.py", line 22, in &lt;module&gt;
      url(r'', app1.views.home),
      NameError: name 'app1' is not defined
  </code></pre>