title: Another custom template tag registration issue in django
body: <p>I know there are similar issues, I tried to learn from them, but still doesn't work. I am trying to register custom template tag in django. I have following error:</p>
  
  <pre><code>django.template.library.InvalidTemplateLibrary: Module  order.templatetags.order_tags does not have a variable named 'register'
  </code></pre>
  
  <p>mytemplate.html:</p>
  
  <pre><code>{% load order_tags %}
  </code></pre>
  
  <p>settings.py:</p>
  
  <pre><code>INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  
  
      "menu",
      "order",
      "page",
      # "user.apps.UserConfig",
  ]
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [os.path.join(BASE_DIR, "order", 'templates')],
          'APP_DIRS': True,
          'OPTIONS': {
              'context_processors': [
                  'django.template.context_processors.debug',
                  'django.template.context_processors.request',
                  'django.contrib.auth.context_processors.auth',
                  'django.contrib.messages.context_processors.messages',
              ],
              "libraries" : {
                  "order_tags" : "order.templatetags.order_tags",
              },
          },
      },
  ]
  </code></pre>
  
  <p>order_tags.py:</p>
  
  <pre><code>from django.template import Library
  
  register = Library()
  
  @register.simple_tag
  def create_var(data):
      return str(data)
  </code></pre>
  
  <p>Structure:</p>
  
  <pre><code>order/
      templates/...
      templatetags/
          __init__.py
         order_tags.py
      forms.py
      models.py
      views.py
  </code></pre>
  
  <p>I tried shutting down the server. I also tried adding <code>"order.templatetags",</code> in INSTALLED_APPS in settings.py.</p>
  
  <p>I also confirmed that order_tags.py loads without an error:</p>
  
  <pre><code>python manage.py shell
  &gt;&gt;&gt; from order.templatetags import order_tags
  </code></pre>
  
  <p><strong>+++UPDATE+++</strong><br>
  When I updated settings.py:</p>
  
  <pre><code>TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [os.path.join(BASE_DIR, "order", 'templates')],
          'APP_DIRS': True,
          'OPTIONS': {
              'context_processors': [
                  'django.template.context_processors.debug',
                  'django.template.context_processors.request',
                  'django.contrib.auth.context_processors.auth',
                  'django.contrib.messages.context_processors.messages',
              ],
          },
      },
  ]
  </code></pre>
  
  <p>Different traceback occurs:</p>
  
  <pre><code>django.template.exceptions.TemplateSyntaxError: 'order_tags' is not a 
  
  registered tag library. Must be one of:
  admin_list
  admin_modify
  admin_static
  admin_urls
  cache
  i18n
  l10n
  log
  static
  staticfiles
  tz
  </code></pre>
  
  <p><strong>+++UPDATE 2+++</strong><br>
  I used pdb to check the source of the problem, but unfortunately I do not understand that:</p>
  
  <pre><code>&gt; &lt;frozen importlib._bootstrap&gt;(191)_get_module_lock()
  (Pdb)
  --Return--
  &gt; &lt;frozen importlib._bootstrap&gt;(191)_get_module_lock()-&gt;_ModuleLock('... 1417680005768
  (Pdb)
  &gt; &lt;frozen importlib._bootstrap&gt;(149)__enter__()
  (Pdb)
  ...
  &gt; &lt;frozen importlib._bootstrap&gt;(91)acquire()
  (Pdb)
  &gt; &lt;frozen importlib._bootstrap&gt;(92)acquire()
  (Pdb)
  &gt; &lt;frozen importlib._bootstrap&gt;(101)acquire()
  (Pdb)
  KeyError: 1884
  &gt; &lt;frozen importlib._bootstrap&gt;(101)acquire()
  (Pdb)
  --Return--
  &gt; &lt;frozen importlib._bootstrap&gt;(101)acquire()-&gt;None
  (Pdb)
  KeyError: 1884
  &gt; &lt;frozen importlib._bootstrap&gt;(149)__enter__()
  (Pdb)
  --Return--
  &gt; &lt;frozen importlib._bootstrap&gt;(149)__enter__()-&gt;None
  (Pdb)
  KeyError: 1884
  &gt; &lt;frozen importlib._bootstrap&gt;(980)_find_and_load()
  (Pdb)
  --Return--
  </code></pre>
  
  <p><br>Thanks!<br>
  Django==2.2.6<br>
  Python==3.7.4</p>