I have made a custom template tag , in apptags.py file which is inside templatetag folder and templatetag folder is inside my application folder, with the following code
from django import template
import datetime
register=template.Library()
@register.simple_tag(name="get_date")
def get_date():
now = datetime.datetime.now()
return now
and im using it in my html file as
% load static %}
{% load apptags %}
{% get_date as today %}
<h2>Today is {{today}} </h2>
and it is showing the below error:
TemplateSyntaxError at /exam/show-test/ 'apptags' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log static tz
P.S :- Templatetag is a package as i've made a init.py file inside it