I see the http://dev.splunk.com/view/SP-CAAAERB and already created a file path, but why is my "hello, world!" program not running?
C:\Program Files\Splunk\etc\apps\your_app_name\django\your_app_name\static\your_app_name\demoview.js
C:\Program Files\Splunk\etc\apps\your_app_name\django\your_app_name\templates\demoview.html
how can i do?
Hi shaoyongyang
Enter manually this URL:
http://localhost:8000/dj/your-djangoapp-name/demoview/
to find your "hello, world!" program
tell me if it satisfy you
HI,
I followed same example, and was able to load the page successfully. I have created/modified following artifacts:
@render_to('your_app_name:demoview.html')
@login_required
def demoview(request):
return{
"message": "Hello World from your_app_name!",
"app_name": "your_app_name",
}
urls.py and views.py are present at : Splunk\etc\apps\your_app_name\django\your_app_name
Thanks!!
Hello!
What are you talking about python? Where did you find python files or snippets in the tutorial? Maybe I use incorrect URL of tutorial. Actually my question is: what I'm doing wrong?
My steps:
1) Created Application "customviewtutorial"
2) created dashboard with the following source code:
Custom View
<html>
<div id="mycustomview"></div>
</html>
3) Created folders appserver/static under the $SPLUNK_HOME/etc/apps/customviewtutorial path.
4) Created customview.js file under $SPLUNK_HOME/etc/apps/customviewtutorial/appserver/static folder with the following source code:
/* customview.js */
require([
"/static/app/customviewtutorial/demoview.js",
"splunkjs/mvc/simplexml/ready!"
], function(DemoView) {
// Create a custom view
var customView = new DemoView({
id: "mycustomview",
el: $("#mycustomview")
}).render();
});
5) Created demoview.js file under $SPLUNK_HOME/etc/apps/customviewtutorial/appserver/static folder with the following source code:
/* demoview.js */
define(function(require, exports, module){
// Base class for custom views
var SimpleSplunkView = require('splunkjs/mvc/simplesplunkview');
// Define the custom view class
var DemoView = SimpleSplunkView.extend({
className: "demoview",
// 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 DemoView;
});
6) Restarted Splunk Instance
7) Trying to call http://localhost:8000/en-GB/app/customviewtutorial/custom_view but noting is hapened. My dashboard is empty.
Maybe my instance doesn't support javascript? How can I test it?
Help me please