All Apps and Add-ons

Custom template tag - ImportError



I'm creating a custom template tag with this tutorial: to create a "state manager". The final result will be a big green "check" icon (ex: or a big red cross + A date under

So, to be simple I decide to set:
app_name as "check"
template tag name as "check"

I create

from django import template
from splunkdj.templatetags.tagutils import component_context
register = template.Library()
@register.inclusion_tag('splunkdj:components/component.html', takes_context=True)
def check(context, id, *args, **kwargs):       # The template tag
    return component_context(
        "check",                           # The custom view's CSS class name
        "check/check",             # Path to the JavaScript class/file for the view


// Custom view tutorial
define(function(require, exports, module) {
    // Load requirements
    var _ = require('underscore');
    var mvc = require('splunkjs/mvc');
    var SimpleSplunkView = require('splunkjs/mvc/simplesplunkview');

    // Define the custom view class
    var CheckView = SimpleSplunkView.extend({
        className: "check",

        // Override the render function to make the view do something
        // In this example: print to the page and to the console
        render: function() {

            // Print to the page
            this.$el.html("Hello, world!");

            // Print to the console
            console.log("Hello, world!");

            return this;
    return CheckView;

And check.html

{% extends 'splunkdj:base_with_account_bar.html' %}

{% load splunkmvc %}

{% load check %}

{% block title %}{{your_app_name}}My Custom View{% endblock title %}

{% block content %}
    <h3>Custom View</h3>
    {% check id="check1" %}
{% endblock content %}

But when I access to : http://localhost:8000/dj/check/check I get:

Traceback (most recent call last):
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\cherrypy\wsgiserver\", line 1237, in communicate
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\cherrypy\wsgiserver\", line 554, in respond
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\cherrypy\wsgiserver\", line 566, in _respond
    response = self.wsgi_app(self.environ, self.start_response)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\cherrypy\", line 239, in __call__
    return app(environ, start_response)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\core\handlers\", line 255, in __call__
    response = self.get_response(request)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\core\handlers\", line 178, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "C:\Program Files\Splunk\etc/apps/framework\server\splunkdj\management\commands\", line 189, in handle_uncaught_exception
    return super(LoggingWSGIHandler, self).handle_uncaught_exception(request, resolver, exc_info, *args, **kwargs)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\core\handlers\", line 220, in handle_uncaught_exception
    if resolver.urlconf_module is None:
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\core\", line 342, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\utils\", line 35, in import_module
  File "C:\Program Files\Splunk\etc/apps/framework\server\", line 129, in <module>
  File "C:\Program Files\Splunk\etc/apps/framework\server\splunkdj\utility\", line 78, in create_javascript_urlpatterns
    tmpl = loader.get_template('splunkdj:jsurls.html')
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\template\", line 146, in get_template
    template, origin = find_template(template_name)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\template\", line 129, in find_template
    loader = find_template_loader(loader_name)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\template\", line 96, in find_template_loader
    mod = import_module(module)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\utils\", line 35, in import_module
  File "C:\Program Files\Splunk\etc/apps/framework\server\splunkdj\loaders\", line 8, in <module>
    from django.template.loaders.app_directories import (
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\django\template\loaders\", line 25, in <module>
    raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
ImproperlyConfigured: ImportError check: No module named check

Do you why did I get this error?


0 Karma
1 Solution


OK, my bad the answer was to create a splunk app with CLI not with splunk Web


View solution in original post

0 Karma


OK, my bad the answer was to create a splunk app with CLI not with splunk Web


0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

February 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...