Developing for Splunk Enterprise

How to pass the values from django view to python backend files and how retrieve the results from python backend files to django view

I am developing an application using django frame work in splunk.

I have created a form which can take input from the user. For this I have created a text box to give input data through html file and created conf file in default folder to initialize the variables and file to read the input values given by the user, in splunk using django frame work.

After giving input data and on click of Submit button, I have to pass this input data from HTML to python back end files, validate the input data in python backend files. This validated data should be converted in to an object. This object should be sent to another HTML file, and the results in the object should be displayed to the user.

My question is using django frame work,
1) How can I pass the input data given by the user from HTML file to python back end file on click of submit button?
2) How to manipulate the data in python backend file? I am not able to dubug the values stored in a variable in python back end file in file. So how can i do it?
3) How to send the output data from python backend file to HTML file and display the output in the HTML file?

Kindly help me on this.

Tags (1)

Splunk Employee
Splunk Employee
  1. You can either use the regular Django Form framework, or you can just regular HTML forms and have it POST to a specific URL, and on the Django side you would configure to have a proper handler for that URL, and you would get the POST variables there.

  2. Using the above, you would gain access to the POST variables on the Python side (in Django), and would be able to modify them. For debugging, you can either use logging (and it will go to django_service.log in var/logs/splunk), or you can attach a Python debugger (e.g. from PyCharm) to the Python application.

  3. You would use regular Django templates here - you would have any variables on the Python side, and would just give it to the template and render them.

State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!