title: How do I reverse an AngularJS route from a Django template?
body: <p>I have a Django application with an AngularJS frontend.  The application sends notification emails, which it renders using Django templates.  </p>
  
  <pre><code>ITEM: {{article.title}}
  DATE: {{article.date}}
  SOURCE: {{article.link}}
  
  {{article.body}}
  </code></pre>
  
  <p>The issue is <code>article.link</code>.  The previous version of the application didn't use Angular, so it was simple to find the link.  In <code>urls.py</code> we had</p>
  
  <pre><code>url(r'article/(?P&lt;article&gt;\d+)/$', views.ArticleView.as_view(), name='show-article')
  </code></pre>
  
  <p>which meant that we could reverse a URL to a particular article with</p>
  
  <pre><code>django.core.urlresolvers.reverse('show-article', kwargs={'article':article_id})
  </code></pre>
  
  <p>Now, on the Angular-based revamp of the site, the display URL for an article looks like <code>/mysite/#/article/1234</code> and is determined by <code>routes.js</code>:</p>
  
  <pre><code>$routeProvider.when('/article/:articleId', { ... } )
  </code></pre>
  
  <p>Bottom line, I don't have a way to grab an AngularJS route from Python.  I could hard-code the all the routes from <code>routes.js</code> into something the backend sees, but it wouldn't be very DRY.  I could generate <code>routes.js</code> dynamically with Django, but right now none of our other JS source is touched by Django -- that doesn't seem very clean either.  Maybe I should continue to support the old-style URLs (<code>/article/1234</code>) as a redirect to the Angular-style URLs (<code>/#/article/1234</code>)?  That still requires logical duplication, I think.</p>
  
  <p>Is there a better pattern I should be using here?</p>