Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8817357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:49:40+00:00 2026-06-14T04:49:40+00:00

The simple idea of the app I am developing is user give the Linux

  • 0

The simple idea of the app I am developing is user give the Linux commands and the result of Linux command will be shown in the webbrowser. Here’s my views.py:

from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.template import RequestContext
import subprocess


globalcmd = 0 
globalresult = 0
def ls(request):
    if request.method == 'POST':
        globalcmd = request.POST.get('command', False)
        globalresult = subprocess.call(['globalcmd'], shell=True)
        return HttpResponseRedirect('/thanks/')
    else:
        pass
    return render_to_response('form.html', {'cmd':'cmd'}, context_instance=RequestContext(request))

def show_template(request):
    return render_to_response('thanks.html', {'globalok':globalresult}, context_instance=RequestContext(request))

I get input from form.html which is processed by view ‘ls’. As a user I am just testing with ls command. Whenever I press ls command it is processed by suprocess.call and stored in globalresult which is later called in thanks.html. My output is 0. What am I doing wrong? Here’s thanks.html:

<h1>
{{ globalresult }}
</h1>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:49:42+00:00Added an answer on June 14, 2026 at 4:49 am

    Check the documentation of the function you are calling, the result is the return-code of the invocation, not the output of the command itself. So, I think that your code does exactly what it should.

    Maybe you intended to call subprocess.check_output?

    As a side note, be very careful with this web-terminal interaction; if you expose this web application to the internet without proper security bad things will happen…. but you probably know that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are developing a web app that will have a pretty complex user and
I'm developing a simple app with multiple views. I have a base view and
The idea is simple. Make a struct for Departments of a store, give it
I'm developing a simple app with a CRUD admin panel, using CodeIgniter. One of
I'm developing a web-app where the user can create multiple related elements and then
I'm developing an android app, I've requirement to show the user current location and
I am developing a simple Android app and am getting a 'App stopped working'
I'm developing my first iPhone app, and while implementing user preferences, I have a
I am developing simple facebook canvas app. I was following this page in documentation:
I'm developing an app where the user adds items to a list. That list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.