Html Button usage to run Python Script

In this Part of Running Python script on clicking html button. I will show you how to Upload a image using Html Form. And Edit the uploaded image using External Python script. And to map the edited image back to Html Page.

Check out this video, code below follows the video to help:
If you like videos like this consider donating $1, or simply turn off AdBlocker. Either helps me to continue making tutorials.

Transcript/ Cheat sheet:

Html Templates :
Home.html => 

Python button script
<button onclick=location.href='{% url ‘script’ %}’>Execute Script</button> <hr>
{% if data %}
{{data | safe}}
{% endif %}
{% if raw_url or edit_url %}
<img src={{raw_url}} height=500 width=500>
<img src={{edit_url}} height=500 width=500>
{% endif %}
<form action=/external/ method=post enctype=multipart/form-data>
{% csrf_token %}
Input Text:
<input type=text name=param required><br><br>
<input type=file name=image required>
<input type=submit value=Execute External Python Script>
</html> =>

import requests
from django.shortcuts import render
import sys
from subprocess import run,PIPE
from import FileSystemStorage
def button(request):
return render(request,home.html)
def output(request):
return render(request,home.html,{data:data})
def external(request):
inp= request.POST.get(param)
print(image is ,image)
print(file raw url,filename)
print(file full url, fileurl)
print(template url,templateurl)
out= run([sys.executable,//mnt//e//work//button-python-click//html button external python script//,inp],shell=False,stdout=PIPE)
image= run([sys.executable,//mnt//e//work//button-python-click//html button external python script//,str(fileurl),str(filename)],shell=False,stdout=PIPE)
return render(request,home.html,{data:out.stdout,raw_url:templateurl,edit_url:image.stdout}) =>


from django.contrib import admin
from django.conf.urls import url
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r^$, views.button),
url(r^output, views.output,name=script),
url(r^external, views.external),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) =>

import os
# Build paths inside the project like this: os.path.join(BASE_DIR, …)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings – unsuitable for production
# See
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = &!eli6&)nyb+c4s!b=9=p@&q6@85_@u39$p6+sk23@v0o1iyhs
# SECURITY WARNING: don’t run with debug turned on in production!
DEBUG = True
MEDIA_URL = /media/
MEDIA_ROOT = os.path.join(BASE_DIR, media)
# Application definition
ROOT_URLCONF = buttonpython.urls
BACKEND: django.template.backends.django.DjangoTemplates,
DIRS: [templates],
context_processors: [
WSGI_APPLICATION = buttonpython.wsgi.application
# Database
default: {
ENGINE: django.db.backends.sqlite3,
NAME: os.path.join(BASE_DIR, db.sqlite3),
# Password validation
NAME: django.contrib.auth.password_validation.UserAttributeSimilarityValidator,
NAME: django.contrib.auth.password_validation.MinimumLengthValidator,
NAME: django.contrib.auth.password_validation.CommonPasswordValidator,
NAME: django.contrib.auth.password_validation.NumericPasswordValidator,
# Internationalization
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
STATIC_URL = /static/


External Python Scripts :

import sys
PIL import Image


import datetime
import sys
output=Hi %s welcome to Hackanons & time is %s % (sys.argv[1],time)
Get Whole Source Code Here

40 thoughts on “Html Button usage to run Python Script

  • December 10, 2019 at 1:46 am

    Excellent and professional investigative services. I hired Mr FRED for a very private and difficult matter of hacking my husband's phone and he far exceeded my expectations. He helped me get some info such as whatsapp, facebook, text messages, call logs and even phone conversations that I needed for proof of his secretive affair. The first time we spoke, we had a very long phone consultation in which he gave me all my options that he could think of to resolve my case, and he even recommended I try other options before hiring him, which shows that he is honest. I decided to hire him and I am glad I did. He is a fantastic investigator and a great person; to all loyal partners out there if you have a dishonest partner don't hesitate to send him a mail Contact: CYBERAPPHACK@GMAIL.COM.

  • December 28, 2019 at 4:47 am

    You guys have surpassed my expectations! James is seriously amazing and is doing everything to help my Fiancé and me, in1weeks my credit score went up 700 points and I can only imagine what is to come. Thank you for the excellent customer service and doing exactly what you all have set out to do! NO GIMMICKS OR BS with you guys.They carry out any kind of hacks You can reachout to them via +16692252253

  • January 28, 2020 at 9:08 am


    It Tears me Up Whenever we receive complaints from Clients About Their Experience With the Hackers They Met Before They Heard about us.
    These Days There Are alot of Hackers Online, You Just Have to Be Careful about who you meet for help, because many people now don't know who to ask for help anymore but there's really an actual solution to that which I am giving you for free, Don't go for the incompetent ones which I know you understand what I'm saying like hackers using gmail, yahoomail and other cheaper email accounts that could be easily hacked ⚠️🚷, come to think of it, why the fuck would a REAL HACKER want to use a Mailing Service that brings out his vulnerabilities? ❌❌ ❌ so can you see they are really not who they say they're, they are just here to Rip people Off, You Can Always Identify Them With Their False Write Ups and False Testimonies Trying To Lure you Into their Arms.❌❌❌ and my advice really goes out to you looking for a Real Hacker that's a heads up so that you wouldn’t fall deep into their trap no more.🚷⚠️⚠️⚠️

    ☑️ COMPOSITE CYBER SECURITY SPECIALISTS is here to Provide you with The Best Hackers, So you can get saved from The Arms of the Fake Hackers❌❌

    ☑️We have Legit Hackers and Private investigators at your service. 💻 Every member of our team is well experienced in their various niches with Great Skills, Technical Hacking Strategies And Positive Online Reviews And Recommendations💻🛠

    ☑️We have Digital Forensic Specialists, Certified Ethical Hackers, Computer Engineers, Cyber Security Experts, Private investigators and more on our team. Some Of These Specialist Includes ⭐️ DAWID CZAGAN⭐️ JACK CABLE ⭐️ SEAN MELIA ⭐️ ARNE SWINNEN ⭐️And More.
    Some Of The Services we render includes:
    * Website hacking 💻
    * Facebook and social media hacking 📲
    * Database hacking, & Blog Cleaning🛠
    * Phone and Gadget Hacking 📲
    * Clearing Of Criminal Records ❌
    * Location Tracking 📲
    and many More

    ☑️ Our Goal is to make your digital life secure, safe and hassle-free. All you Need To do is To Write us a Mail Then We’ll Assigned any of These Hackers To You Instantly.

    ☑️ CONTACT:
    ••• Email:

    🔘2020 © composite cybersecurity specialists
    🔘Want faster service? Contact us!
    🔘All Rights Reserved ®️

  • February 4, 2020 at 2:30 am

    My ex ruined my credit due to his incessant extravagant spending spree, I found myself in a big mess. I talked to a credit repair company and I was told that it would take me non less than a year to fix my credit. I was devastated, that's a very long time which I can't cope with. I looked online and came across Credit Doctor's contact, hit him up and to my greatest surprise, my credit was repaired in 4 working days from 486 -810. I was so amazed and it didn't cost me too much really. I implore you to contact him on for all credit issues and hacking issues. No doubt that he's the best out there and your problems will be solved!

  • February 16, 2020 at 9:39 am

    I've been seeing posts and testimonials about BLANK ATM CARD but I never believed it, not until I tried it myself. It was on the 12th day of March. I was reading a post about places to visit in Slovakia when I saw this captivating post about how a Man described as Mr Harry changed his life with the help of a Blank Atm Card. I didn't believe it at first until I decided to reach him through the mail address attached to the post. To my greatest imagination, it was real. Right now am living up to a standard I never used to live before. Today might be your lucky day! Reach Mr Harry via email:( see you on the brighter side of life.

  • February 17, 2020 at 1:51 am

    Get your credit cleaned with the help of a reliable hacker. He's tested and trusted. I had a very low credit score (around 520) and it was ruining my life. I needed help. I was very depressed because of it and had been trying to repair it but It just seems nothing was capable of getting my score raised quickly. I needed something done fast. I had read a lot of good things about this hacker online which gave me a go ahead to try him out. I almost gave up my search for a real hacker because I kept meeting fake hackers who are always after the money, I've been conned by them. Hackinvade  is not about the money but about attaining a good reputation at always satisfying his customers. This is my way of showing appreciation for a job well done on my credit report. Reach out to him for help at hackinvade |AT| gmail |DOT| com or his phone # 256-294-4701.  

  • March 10, 2020 at 2:19 pm

    Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot. I was exploring this particular info for a long time. Thanks to this blog my exploration has ended. video agentur

  • March 28, 2020 at 8:51 pm

    My spouse and I stumbled over here by a different web address and thought I might check things out. I like what I see so i am just following you. Look forward to checking out your web page again. webflow agency

  • March 29, 2020 at 10:05 pm

    Oh my goodness! a tremendous article dude. Thank you Nonetheless I'm experiencing difficulty with ur rss . Don know why Unable to subscribe to it. Is there anybody getting equivalent rss problem? Anybody who is aware of kindly respond. Thnkx webflow developers

  • April 5, 2020 at 10:46 am

    Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!Thanks 统计代写

  • April 10, 2020 at 4:39 pm

    It is very difficult to find the movie of your choice particularly in horror movies genre. New-age online shopping portals are offering many titles under this category.


  • April 12, 2020 at 9:16 am

    When it comes to movie distribution for an indie produced film the way it normally happens are independent producers and filmmakers take the risk making the movie without any guaranteed movie distribution deal in place.

  • April 23, 2020 at 8:45 am

    Those type of indie film passion projects you can make once you've made it in the entertainment business at the studio level.123 movies

  • April 30, 2020 at 9:47 am

    Good site! I really love how it is simple on my eyes and the data are well written. I am wondering how I might be notified whenever a new post has been made. I have subscribed to your RSS which must do the trick! Have a great day! ui ux design

  • May 9, 2020 at 11:52 am

    Thank you for some other informative website. The place else may just I get that kind of information written in such a perfect method? I have a venture that I am simply now running on, and I’ve been at the glance out for such info. brand design firm

  • May 9, 2020 at 9:56 pm

    Sure, you can scour the internet and find scads of great topless or semi-nude and suggestive pix of Anderson, but that's not Scully, damnit! Bravo to Chris Carter and Gillian Anderson…uh…sort of.123movie

  • May 12, 2020 at 11:03 am

    Also, most films don't get a theatrical release, and the funds are earned through other channels.


  • May 13, 2020 at 8:37 am

    Many thanks taking a few minutes to discuss this unique, I find myself passionately with this and also adoration looking over on that problem. Just in case likely, since complete specialist knowledge, on earth would you feelings modernizing your main internet page along with other facts? This is very helpful for me.

  • May 20, 2020 at 10:51 am

    He proves that film is a really powerful medium, and even though the formula conquers the motion picture industry, a filmmaker can still live up with a unique language that is challenging and refreshing – and this is such an achievement.0123movies

  • May 26, 2020 at 4:00 pm

    Additionally, it doesn’t matter how extremely you should be complete with treating a very platform, gradually you’ll discover an instance the places you should want to do a number instruct care; and as a consequence influenced by your real age but also bodybuilding, therfore the inches of one’s caravan it could be a awfully excessive pastime. motor movers web development firms

  • May 26, 2020 at 6:45 pm


    Hello my dear people, I am Linda McDonald, currently living in Austin Texas, USA. I am a widow at the moment with three kids and i was stuck in a financial situation in April 2018 and i needed to refinance and pay my bills. I tried seeking loans from various loan firms both private and corporate but never with success, and most banks declined my credit ,do not full prey to those hoodlums at there that call them self-money lender they are all scam , all they want is your money and you well not hear from them again they have done it to me twice before I met Mr. David Wilson the most interesting part of it is that my loan was transfer to me within 74hours so I will advise you to contact Mr. David if you are interested in getting loan and you are sure you can pay him back on time you can contact him via email……… ( No credit check, no cosigner with just 2% interest rate and better repayment plans and schedule if you must contact any firm with reference to securing a loan without collateral then contact Mr. David Wilson today for your loan

    They offer all kind of categories of loan they

    Short term loan (5_10years)
    Long term loan (20_40)
    Media term loan (10_20)
    They offer loan like
    Home loan…………., Business loan…….. Debt loan…….
    Student loan………., Business startup loan
    Business loan……., Company loan………….. etc
    When it comes to financial crisis and loan then David Wilson loan financial is the place to go please just tell him I Mrs. Linda McDonald direct you Good Luck…………………..

  • June 5, 2020 at 7:22 pm

    Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. seorango

  • June 6, 2020 at 9:55 am

    Hello I found the Free Simple Shopping Icons Download | Design, Tech and Internet post very interesting therefore I’ve included our track-back for it on my own webpage, continue the great job:) web design agency new york

  • June 7, 2020 at 8:48 am

    Come across back yard garden unusual periods of one’s Are generally Weight reduction and every one one may be important. One way state could possibly be substantial squandering through the diet. lose weight website design company nyc

  • June 7, 2020 at 9:21 am

    There is greaser violence (not Grease greaser violence but like the Outsiders with a 90's humor twist), there is great Rockabilly music from Glen Glenn, Hasil Adkins and Johnny Reno!

  • June 8, 2020 at 3:04 pm

    I used to be recommended this web site by my cousin. I’m no longer sure whether this put up is written via him as nobody else know such exact approximately my problem. You’re amazing! Thank you! web design agency new york

  • June 13, 2020 at 5:34 am

    This is a well-researched article which you have shared here about edit the uploaded image using external python. This is a very informative and useful article. This type of advice is not easy to find so, thanks for this information Watermark Edit Image Online

  • July 2, 2020 at 3:37 pm

    Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info.
    website design long island


Leave a Reply

Your email address will not be published. Required fields are marked *