Django: Template Does Not Exist Error
<p>In My django app I have a view called 'StatsView' given below:</p>

<pre><code>class StatsView(LoginRequiredMixin, View):
    login_url = '/signin/'

    def get(self, request, template='app_folder/ad_accounts/pixel_stats.html', *args, **kwargs):
        #Code
        return render(request, template, context)
</code></pre>

<p><code>app/urls.py</code></p>

<pre><code>url(
    r'^ad_accounts/(?P&lt;ad_account_id&gt;[^/]+)/pixel_stats',
    StatsView.as_view(),
    name="pixel_stats"
),
</code></pre>

<p><strong>template</strong>
<code>pixel_stats.html</code></p>

<pre><code>&lt;p&gt; test&lt;/p&gt;
</code></pre>

<p>However when I go to <code>localhost:8000/ad_accounts/acctid/pixel_stats/</code> I keep running into a <code>Template DoesNotExist Error</code>. I cant seem to figure out where Im going wrong. Ive added a bunch of URLs and havent run into this issue for any one them.</p>

<p>My app structure is as follows:</p>

<pre><code>project/
  app/
    templates/
      app_folder/
        ad_accounts/
          pixel_stats.html
    views/
      ad_accounts/
        stats.py
</code></pre>

<p>Silly mistake. Solved it by adding a <code>$</code> at the end in my <code>url</code>.</p>

<pre><code>url(
    r'^ad_accounts/(?P&lt;ad_account_id&gt;[^/]+)/pixel_stats/$',
    StatsView.as_view(),
    name="pixel_stats"
),
</code></pre>

python django