title: Reverse for 'login' with arguments '()' and keyword arguments '{}' not found
body: <p>I want to use reverse() in my Django view to avoid hard code, but get "<strong>Reverse for 'login' with arguments '()' and keyword arguments '{}' not found</strong>".  Here is my code:</p>
  
  <p>URLConf:</p>
  
  <pre><code>urlpatterns = patterns(
      '',
      url(r'^accounts/', include('accounts.urls', namespace="accounts")),
      url(r'^admin/', include(admin.site.urls)),
  )
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>urlpatterns = patterns(
      '',
      url(r'^login/$', views.login, name='login'),
      url(r'^signup/$', views.signup, name='signup'),
  )
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>def login(request):
      return render(request, reverse("login"))
  
  
  def signup(request):
      return render(request, reverse("signup"))
  </code></pre>
  
  <p>Here is my traceback info:</p>
  
  <blockquote>
    <p>Environment:  </p>
    
    <p>Request Method: GET<br>
    Request URL: <code>http://127.0.0.1:8000/accounts/login/</code>  </p>
    
    <p>Django Version: 1.7<br>
    Python Version: 2.7.5<br>
    Installed Applications:<br>
    ('django.contrib.admin',<br>
    'django.contrib.auth',<br>
    'django.contrib.contenttypes',<br>
    'django.contrib.sessions',<br>
    'django.contrib.messages',<br>
    'django.contrib.staticfiles',<br>
    'accounts')<br>
    Installed Middleware:<br>
    ('django.contrib.sessions.middleware.SessionMiddleware',<br>
    'django.middleware.common.CommonMiddleware',<br>
    'django.middleware.csrf.CsrfViewMiddleware',<br>
    'django.contrib.auth.middleware.AuthenticationMiddleware',<br>
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',<br>
    'django.contrib.messages.middleware.MessageMiddleware',<br>
    'django.middleware.clickjacking.XFrameOptionsMiddleware')  </p>
    
    <p>Traceback:
    File "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
      111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)<br>
    File "/Users/feizhao/dropbox/nahan/accounts/views.py" in login
      11.     return render(request, reverse("login"))
    File "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/core/urlresolvers.py" in reverse
      546.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))<br>
    File "/Users/feizhao/.virtualenvs/nahan/lib/python2.7/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
      463.                              (lookup_view_s, args, kwargs, len(patterns), patterns))</p>
    
    <p>Exception Type: NoReverseMatch at /accounts/login/<br>
    Exception Value: Reverse for 'login' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []  </p>
  </blockquote>
  
  <p>I've seen some similar question in stackoverflow already, such as <a href="https://stackoverflow.com/questions/11383534/reverse-for-with-arguments-and-keyword-arguments-not-found">here</a>, but no help.  </p>
  
  <p>Anyone can tell me why it's wrong?  Thanks very much!</p>