├── Image Edit Html Button Run Python Script
├── buttonpython
│ ├── buttonpython
│ │ ├── __pycache__
│ │ │ ├── settings.cpython-36.pyc
│ │ │ ├── urls.cpython-36.pyc
│ │ │ ├── views.cpython-36.pyc
│ │ │ └── wsgi.cpython-36.pyc
│ │ ├── settings.py
│ │ ├── urls.py
│ │ ├── views.py
│ │ └── wsgi.py
│ ├── db.sqlite3
│ ├── manage.py
│ ├── media
│ │ ├── part3 flow.png
│ │ └── temp.png
│ └── templates
│ │ └── home.html
├── image.py
└── test.py
├── Run Python Script Html Flask
├── HTML Button Image Process Python Script 2.1
│ ├── main.py
│ ├── static
│ │ └── Images
│ │ │ └── Capture.JPG
│ └── templates
│ │ └── main.html
└── Html Button to Python Script
│ ├── app.py
│ ├── static
│ └── index.css
│ └── templates
│ └── index.html
├── buttonpython
├── buttonpython
│ ├── __init__.pyc
│ ├── settings.py
│ ├── settings.pyc
│ ├── urls.py
│ ├── urls.pyc
│ ├── views.py
│ ├── views.pyc
│ ├── wsgi.py
│ └── wsgi.pyc
├── db.sqlite3
├── manage.py
└── templates
│ └── home.html
└── html button external python script
├── buttonpython
├── buttonpython
│ ├── __pycache__
│ │ ├── settings.cpython-36.pyc
│ │ ├── urls.cpython-36.pyc
│ │ ├── views.cpython-36.pyc
│ │ └── wsgi.cpython-36.pyc
│ ├── settings.py
│ ├── urls.py
│ ├── views.py
│ └── wsgi.py
├── db.sqlite3
├── manage.py
└── templates
│ └── home.html
└── test.py
/Image Edit Html Button Run Python Script/buttonpython/buttonpython/__pycache__/settings.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/Image Edit Html Button Run Python Script/buttonpython/buttonpython/__pycache__/settings.cpython-36.pyc
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/buttonpython/__pycache__/urls.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/Image Edit Html Button Run Python Script/buttonpython/buttonpython/__pycache__/urls.cpython-36.pyc
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/buttonpython/__pycache__/views.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/Image Edit Html Button Run Python Script/buttonpython/buttonpython/__pycache__/views.cpython-36.pyc
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/buttonpython/__pycache__/wsgi.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/Image Edit Html Button Run Python Script/buttonpython/buttonpython/__pycache__/wsgi.cpython-36.pyc
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/buttonpython/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for buttonpython project.
3 |
4 | Generated by 'django-admin startproject' using Django 1.11.2.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/1.11/ref/settings/
11 | """
12 |
13 | import os
14 |
15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17 |
18 |
19 | # Quick-start development settings - unsuitable for production
20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
21 |
22 | # SECURITY WARNING: keep the secret key used in production secret!
23 | SECRET_KEY = '&!eli6&)nyb+c4s!b=9=p@&q6@85_@u39$p6+sk23@v0o1iyhs'
24 |
25 | # SECURITY WARNING: don't run with debug turned on in production!
26 | DEBUG = True
27 |
28 | ALLOWED_HOSTS = []
29 |
30 | MEDIA_URL = '/media/'
31 | MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
32 |
33 | # Application definition
34 |
35 | INSTALLED_APPS = [
36 | 'django.contrib.admin',
37 | 'django.contrib.auth',
38 | 'django.contrib.contenttypes',
39 | 'django.contrib.sessions',
40 | 'django.contrib.messages',
41 | 'django.contrib.staticfiles',
42 | ]
43 |
44 | MIDDLEWARE = [
45 | 'django.middleware.security.SecurityMiddleware',
46 | 'django.contrib.sessions.middleware.SessionMiddleware',
47 | 'django.middleware.common.CommonMiddleware',
48 | 'django.middleware.csrf.CsrfViewMiddleware',
49 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
50 | 'django.contrib.messages.middleware.MessageMiddleware',
51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
52 | ]
53 |
54 | ROOT_URLCONF = 'buttonpython.urls'
55 |
56 | TEMPLATES = [
57 | {
58 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
59 | 'DIRS': ['templates'],
60 | 'APP_DIRS': True,
61 | 'OPTIONS': {
62 | 'context_processors': [
63 | 'django.template.context_processors.debug',
64 | 'django.template.context_processors.request',
65 | 'django.contrib.auth.context_processors.auth',
66 | 'django.contrib.messages.context_processors.messages',
67 | ],
68 | },
69 | },
70 | ]
71 |
72 | WSGI_APPLICATION = 'buttonpython.wsgi.application'
73 |
74 |
75 | # Database
76 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
77 |
78 | DATABASES = {
79 | 'default': {
80 | 'ENGINE': 'django.db.backends.sqlite3',
81 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
82 | }
83 | }
84 |
85 |
86 | # Password validation
87 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
88 |
89 | AUTH_PASSWORD_VALIDATORS = [
90 | {
91 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
92 | },
93 | {
94 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
95 | },
96 | {
97 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
98 | },
99 | {
100 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
101 | },
102 | ]
103 |
104 |
105 | # Internationalization
106 | # https://docs.djangoproject.com/en/1.11/topics/i18n/
107 |
108 | LANGUAGE_CODE = 'en-us'
109 |
110 | TIME_ZONE = 'UTC'
111 |
112 | USE_I18N = True
113 |
114 | USE_L10N = True
115 |
116 | USE_TZ = True
117 |
118 |
119 | # Static files (CSS, JavaScript, Images)
120 | # https://docs.djangoproject.com/en/1.11/howto/static-files/
121 |
122 | STATIC_URL = '/static/'
123 |
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/buttonpython/urls.py:
--------------------------------------------------------------------------------
1 | """buttonpython URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.conf.urls import url, include
14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15 | """
16 | from django.conf.urls import url
17 | from django.contrib import admin
18 | from django.conf import settings
19 | from django.conf.urls.static import static
20 |
21 | from . import views
22 | urlpatterns = [
23 | url(r'^admin/', admin.site.urls),
24 | url(r'^$', views.button),
25 | url(r'^output', views.output,name="script"),
26 | url(r'^external', views.external),
27 | ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
28 |
29 |
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/buttonpython/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 | import requests
3 | import sys
4 | from subprocess import run,PIPE
5 | from django.core.files.storage import FileSystemStorage
6 |
7 | def button(request):
8 |
9 | return render(request,'home.html')
10 |
11 | def output(request):
12 | data=requests.get("https://www.google.com/")
13 | print(data.text)
14 | data=data.text
15 | return render(request,'home.html',{'data':data})
16 |
17 | def external(request):
18 | inp= request.POST.get('param')
19 | image=request.FILES['image']
20 | print("image is ",image)
21 | fs=FileSystemStorage()
22 | filename=fs.save(image.name,image)
23 | fileurl=fs.open(filename)
24 | templateurl=fs.url(filename)
25 | print("file raw url",filename)
26 | print("file full url", fileurl)
27 | print("template url",templateurl)
28 | out= run([sys.executable,'//mnt//e//work//button-python-click//html button external python script//test.py',inp],shell=False,stdout=PIPE)
29 | image= run([sys.executable,'//mnt//e//work//button-python-click//html button external python script//image.py',str(fileurl),str(filename)],shell=False,stdout=PIPE)
30 | print(out)
31 | print(image.stdout)
32 | return render(request,'home.html',{'data':out.stdout,'raw_url':templateurl,'edit_url':image.stdout})
33 |
34 |
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/buttonpython/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for buttonpython project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "buttonpython.settings")
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/Image Edit Html Button Run Python Script/buttonpython/db.sqlite3
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "buttonpython.settings")
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError:
10 | # The above import may fail for some other reason. Ensure that the
11 | # issue is really that Django is missing to avoid masking other
12 | # exceptions on Python 2.
13 | try:
14 | import django
15 | except ImportError:
16 | raise ImportError(
17 | "Couldn't import Django. Are you sure it's installed and "
18 | "available on your PYTHONPATH environment variable? Did you "
19 | "forget to activate a virtual environment?"
20 | )
21 | raise
22 | execute_from_command_line(sys.argv)
23 |
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/media/part3 flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/Image Edit Html Button Run Python Script/buttonpython/media/part3 flow.png
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/media/temp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/Image Edit Html Button Run Python Script/buttonpython/media/temp.png
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/buttonpython/templates/home.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Python button script
6 |
7 |
8 |
9 |
10 | {% if data %}
11 |
12 | {{data | safe}}
13 |
14 | {% endif %}
15 |
16 | {% if raw_url or edit_url %}
17 |
18 | RAW IMAGE:
19 |
20 | PROCESSED IMAGE:
21 |
22 |
23 |
24 | {% endif %}
25 |
26 |
27 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/image.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PIL import Image
3 |
4 | image_fullpath=sys.argv[1]
5 | image_name=sys.argv[2]
6 |
7 | img= Image.open(str(image_fullpath))
8 |
9 | image_save_path=image_fullpath.replace(image_name,"temp.png")
10 | img.rotate(90).convert("LA").save(image_save_path)
11 |
12 | print("/media/temp.png")
13 |
14 |
--------------------------------------------------------------------------------
/Image Edit Html Button Run Python Script/test.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import datetime
3 |
4 |
5 | time=datetime.datetime.now()
6 |
7 | output="Hi %s welcome to Hackanons & time is %s" % (sys.argv[1],time)
8 |
9 | print(output)
10 |
11 |
--------------------------------------------------------------------------------
/Run Python Script Html Flask/HTML Button Image Process Python Script 2.1/main.py:
--------------------------------------------------------------------------------
1 | from flask import Flask,request,render_template,redirect
2 | import os
3 | app = Flask(__name__)
4 |
5 |
6 | app.config["IMAGE_UPLOADS"] = "/Users/Carl/Desktop/Playlist/HTML Button 3/static/Images"
7 | #app.config["ALLOWED_IMAGE_EXTENSIONS"] = ["PNG","JPG","JPEG"]
8 |
9 | from werkzeug.utils import secure_filename
10 |
11 |
12 | @app.route('/home',methods = ["GET","POST"])
13 | def upload_image():
14 | if request.method == "POST":
15 | image = request.files['file']
16 |
17 | if image.filename == '':
18 | print("Image must have a file name")
19 | return redirect(request.url)
20 |
21 |
22 | filename = secure_filename(image.filename)
23 |
24 | basedir = os.path.abspath(os.path.dirname(__file__))
25 | image.save(os.path.join(basedir,app.config["IMAGE_UPLOADS"],filename))
26 |
27 | return render_template("main.html",filename=filename)
28 |
29 |
30 |
31 | return render_template('main.html')
32 |
33 |
34 | @app.route('/display/')
35 | def display_image(filename):
36 | return redirect(url_for('static',filename = "/Images" + filename), code=301)
37 |
38 |
39 | app.run(debug=True,port=2000)
--------------------------------------------------------------------------------
/Run Python Script Html Flask/HTML Button Image Process Python Script 2.1/static/Images/Capture.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/Run Python Script Html Flask/HTML Button Image Process Python Script 2.1/static/Images/Capture.JPG
--------------------------------------------------------------------------------
/Run Python Script Html Flask/HTML Button Image Process Python Script 2.1/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 | Python Flask File Upload Example
3 | Select a file to upload
4 |
5 | {% if filename %}
6 |
7 |
 }})
8 |
9 | {% endif %}
10 |
--------------------------------------------------------------------------------
/Run Python Script Html Flask/Html Button to Python Script/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, render_template, url_for, request
2 |
3 | app = Flask(__name__)
4 |
5 |
6 |
7 | @app.route('/')
8 | @app.route('/home')
9 | def home():
10 | return render_template("index.html")
11 |
12 |
13 |
14 | @app.route('/result',methods=['POST', 'GET'])
15 | def result():
16 | output = request.form.to_dict()
17 | print(output)
18 | name = output["name"]
19 |
20 |
21 | return render_template('index.html', name = name)
22 |
23 |
24 |
25 |
26 |
27 | if __name__ == "__main__":
28 | app.run(debug=True)
--------------------------------------------------------------------------------
/Run Python Script Html Flask/Html Button to Python Script/static/index.css:
--------------------------------------------------------------------------------
1 | html,body{
2 | margin: 0px;
3 | padding: 0px;
4 | list-style: none;
5 | box-sizing: border-box;
6 | font-family: 'Rubik';
7 | letter-spacing: 3px;
8 | }
9 |
10 |
11 | /* element */
12 |
13 | .let_space{
14 | letter-spacing: 2px;
15 | }
16 |
17 |
18 | .c_grid{
19 | display: grid;
20 | justify-items: center;
21 | align-items: center;
22 | grid-gap: 2vmax;
23 | }
24 |
25 | .grid{
26 | display: grid;
27 | grid-gap: 2vmax;
28 | }
29 |
30 |
31 |
32 | .box2{
33 | grid-template-columns: 1fr 1fr;
34 | }
35 |
36 | .box3{
37 | grid-template-columns: 1fr 1fr 1fr;
38 | }
39 |
40 | /* element */
41 |
42 | .table_cont{
43 | overflow-x: scroll;
44 | width: 70vw;
45 | }
46 |
47 | table {
48 | border-collapse: collapse;
49 | letter-spacing: 3px;
50 | /* width: 100%; */
51 | }
52 |
53 | td, th {
54 | border: 1px solid #dddddd;
55 | text-align: center;
56 | padding: 1vmax;
57 | width: fit-content;
58 | }
59 |
60 | form{
61 | margin: 2vmax 10vmax;
62 | padding:3vmax;
63 | border: 1px solid #dddddd;
64 | }
65 |
66 | label{
67 | font-size: 1.5vmax;
68 | }
69 |
70 | input{
71 | padding:1vmax;
72 | font-size: 1.3vmax;
73 | border: 1px solid #dddddd;
74 | outline: none;
75 | }
76 |
77 | select{
78 | padding:1vmax;
79 | font-size: 1.3vmax;
80 | border: 1px solid #dddddd;
81 | outline: none;
82 | letter-spacing: 3px;
83 | }
84 |
85 | option{
86 | font-size: 1.5vmax;
87 | letter-spacing: 3px;
88 | }
89 |
90 | .file_submit{
91 | margin-top: 1vmax;
92 | border: 1px solid #55acee;
93 | outline: none;
94 | background-color: #55acee;
95 | color: white;
96 | padding: 1vmax;
97 | cursor: pointer;
98 | transition: 0.3s;
99 | letter-spacing: 3px;
100 | }
101 |
102 | .file_submit:hover{
103 | background-color: white;
104 | color: #55acee
105 | }
--------------------------------------------------------------------------------
/Run Python Script Html Flask/Html Button to Python Script/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/buttonpython/buttonpython/__init__.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/buttonpython/buttonpython/__init__.pyc
--------------------------------------------------------------------------------
/buttonpython/buttonpython/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for buttonpython project.
3 |
4 | Generated by 'django-admin startproject' using Django 1.11.2.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/1.11/ref/settings/
11 | """
12 |
13 | import os
14 |
15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17 |
18 |
19 | # Quick-start development settings - unsuitable for production
20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
21 |
22 | # SECURITY WARNING: keep the secret key used in production secret!
23 | SECRET_KEY = '&!eli6&)nyb+c4s!b=9=p@&q6@85_@u39$p6+sk23@v0o1iyhs'
24 |
25 | # SECURITY WARNING: don't run with debug turned on in production!
26 | DEBUG = True
27 |
28 | ALLOWED_HOSTS = []
29 |
30 |
31 | # Application definition
32 |
33 | INSTALLED_APPS = [
34 | 'django.contrib.admin',
35 | 'django.contrib.auth',
36 | 'django.contrib.contenttypes',
37 | 'django.contrib.sessions',
38 | 'django.contrib.messages',
39 | 'django.contrib.staticfiles',
40 | ]
41 |
42 | MIDDLEWARE = [
43 | 'django.middleware.security.SecurityMiddleware',
44 | 'django.contrib.sessions.middleware.SessionMiddleware',
45 | 'django.middleware.common.CommonMiddleware',
46 | 'django.middleware.csrf.CsrfViewMiddleware',
47 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
48 | 'django.contrib.messages.middleware.MessageMiddleware',
49 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
50 | ]
51 |
52 | ROOT_URLCONF = 'buttonpython.urls'
53 |
54 | TEMPLATES = [
55 | {
56 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
57 | 'DIRS': ['templates'],
58 | 'APP_DIRS': True,
59 | 'OPTIONS': {
60 | 'context_processors': [
61 | 'django.template.context_processors.debug',
62 | 'django.template.context_processors.request',
63 | 'django.contrib.auth.context_processors.auth',
64 | 'django.contrib.messages.context_processors.messages',
65 | ],
66 | },
67 | },
68 | ]
69 |
70 | WSGI_APPLICATION = 'buttonpython.wsgi.application'
71 |
72 |
73 | # Database
74 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
75 |
76 | DATABASES = {
77 | 'default': {
78 | 'ENGINE': 'django.db.backends.sqlite3',
79 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
80 | }
81 | }
82 |
83 |
84 | # Password validation
85 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
86 |
87 | AUTH_PASSWORD_VALIDATORS = [
88 | {
89 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
90 | },
91 | {
92 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
93 | },
94 | {
95 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
96 | },
97 | {
98 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
99 | },
100 | ]
101 |
102 |
103 | # Internationalization
104 | # https://docs.djangoproject.com/en/1.11/topics/i18n/
105 |
106 | LANGUAGE_CODE = 'en-us'
107 |
108 | TIME_ZONE = 'UTC'
109 |
110 | USE_I18N = True
111 |
112 | USE_L10N = True
113 |
114 | USE_TZ = True
115 |
116 |
117 | # Static files (CSS, JavaScript, Images)
118 | # https://docs.djangoproject.com/en/1.11/howto/static-files/
119 |
120 | STATIC_URL = '/static/'
121 |
--------------------------------------------------------------------------------
/buttonpython/buttonpython/settings.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/buttonpython/buttonpython/settings.pyc
--------------------------------------------------------------------------------
/buttonpython/buttonpython/urls.py:
--------------------------------------------------------------------------------
1 | """buttonpython URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.conf.urls import url, include
14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15 | """
16 | from django.conf.urls import url
17 | from django.contrib import admin
18 | from . import views
19 | urlpatterns = [
20 | url(r'^admin/', admin.site.urls),
21 | url(r'^$', views.button),
22 | url(r'^output', views.output,name="script"),
23 | ]
24 |
--------------------------------------------------------------------------------
/buttonpython/buttonpython/urls.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/buttonpython/buttonpython/urls.pyc
--------------------------------------------------------------------------------
/buttonpython/buttonpython/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 | import requests
3 |
4 |
5 | def button(request):
6 |
7 | return render(request,'home.html')
8 |
9 | def output(request):
10 | data=requests.get("https://www.google.com/")
11 | print(data.text)
12 | data=data.text
13 | return render(request,'home.html',{'data':data})
--------------------------------------------------------------------------------
/buttonpython/buttonpython/views.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/buttonpython/buttonpython/views.pyc
--------------------------------------------------------------------------------
/buttonpython/buttonpython/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for buttonpython project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "buttonpython.settings")
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/buttonpython/buttonpython/wsgi.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/buttonpython/buttonpython/wsgi.pyc
--------------------------------------------------------------------------------
/buttonpython/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/buttonpython/db.sqlite3
--------------------------------------------------------------------------------
/buttonpython/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "buttonpython.settings")
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError:
10 | # The above import may fail for some other reason. Ensure that the
11 | # issue is really that Django is missing to avoid masking other
12 | # exceptions on Python 2.
13 | try:
14 | import django
15 | except ImportError:
16 | raise ImportError(
17 | "Couldn't import Django. Are you sure it's installed and "
18 | "available on your PYTHONPATH environment variable? Did you "
19 | "forget to activate a virtual environment?"
20 | )
21 | raise
22 | execute_from_command_line(sys.argv)
23 |
--------------------------------------------------------------------------------
/buttonpython/templates/home.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Python button script
6 |
7 |
8 |
9 |
10 | {% if data %}
11 |
12 | {{data | safe}}
13 |
14 | {% endif %}
15 |
16 |
17 |
--------------------------------------------------------------------------------
/html button external python script/buttonpython/buttonpython/__pycache__/settings.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/html button external python script/buttonpython/buttonpython/__pycache__/settings.cpython-36.pyc
--------------------------------------------------------------------------------
/html button external python script/buttonpython/buttonpython/__pycache__/urls.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/html button external python script/buttonpython/buttonpython/__pycache__/urls.cpython-36.pyc
--------------------------------------------------------------------------------
/html button external python script/buttonpython/buttonpython/__pycache__/views.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/html button external python script/buttonpython/buttonpython/__pycache__/views.cpython-36.pyc
--------------------------------------------------------------------------------
/html button external python script/buttonpython/buttonpython/__pycache__/wsgi.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/html button external python script/buttonpython/buttonpython/__pycache__/wsgi.cpython-36.pyc
--------------------------------------------------------------------------------
/html button external python script/buttonpython/buttonpython/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for buttonpython project.
3 |
4 | Generated by 'django-admin startproject' using Django 1.11.2.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/1.11/ref/settings/
11 | """
12 |
13 | import os
14 |
15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17 |
18 |
19 | # Quick-start development settings - unsuitable for production
20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
21 |
22 | # SECURITY WARNING: keep the secret key used in production secret!
23 | SECRET_KEY = '&!eli6&)nyb+c4s!b=9=p@&q6@85_@u39$p6+sk23@v0o1iyhs'
24 |
25 | # SECURITY WARNING: don't run with debug turned on in production!
26 | DEBUG = True
27 |
28 | ALLOWED_HOSTS = []
29 |
30 |
31 | # Application definition
32 |
33 | INSTALLED_APPS = [
34 | 'django.contrib.admin',
35 | 'django.contrib.auth',
36 | 'django.contrib.contenttypes',
37 | 'django.contrib.sessions',
38 | 'django.contrib.messages',
39 | 'django.contrib.staticfiles',
40 | ]
41 |
42 | MIDDLEWARE = [
43 | 'django.middleware.security.SecurityMiddleware',
44 | 'django.contrib.sessions.middleware.SessionMiddleware',
45 | 'django.middleware.common.CommonMiddleware',
46 | 'django.middleware.csrf.CsrfViewMiddleware',
47 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
48 | 'django.contrib.messages.middleware.MessageMiddleware',
49 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
50 | ]
51 |
52 | ROOT_URLCONF = 'buttonpython.urls'
53 |
54 | TEMPLATES = [
55 | {
56 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
57 | 'DIRS': ['templates'],
58 | 'APP_DIRS': True,
59 | 'OPTIONS': {
60 | 'context_processors': [
61 | 'django.template.context_processors.debug',
62 | 'django.template.context_processors.request',
63 | 'django.contrib.auth.context_processors.auth',
64 | 'django.contrib.messages.context_processors.messages',
65 | ],
66 | },
67 | },
68 | ]
69 |
70 | WSGI_APPLICATION = 'buttonpython.wsgi.application'
71 |
72 |
73 | # Database
74 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
75 |
76 | DATABASES = {
77 | 'default': {
78 | 'ENGINE': 'django.db.backends.sqlite3',
79 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
80 | }
81 | }
82 |
83 |
84 | # Password validation
85 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
86 |
87 | AUTH_PASSWORD_VALIDATORS = [
88 | {
89 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
90 | },
91 | {
92 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
93 | },
94 | {
95 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
96 | },
97 | {
98 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
99 | },
100 | ]
101 |
102 |
103 | # Internationalization
104 | # https://docs.djangoproject.com/en/1.11/topics/i18n/
105 |
106 | LANGUAGE_CODE = 'en-us'
107 |
108 | TIME_ZONE = 'UTC'
109 |
110 | USE_I18N = True
111 |
112 | USE_L10N = True
113 |
114 | USE_TZ = True
115 |
116 |
117 | # Static files (CSS, JavaScript, Images)
118 | # https://docs.djangoproject.com/en/1.11/howto/static-files/
119 |
120 | STATIC_URL = '/static/'
121 |
--------------------------------------------------------------------------------
/html button external python script/buttonpython/buttonpython/urls.py:
--------------------------------------------------------------------------------
1 | """buttonpython URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.conf.urls import url, include
14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15 | """
16 | from django.conf.urls import url
17 | from django.contrib import admin
18 | from . import views
19 | urlpatterns = [
20 | url(r'^admin/', admin.site.urls),
21 | url(r'^$', views.button),
22 | url(r'^output', views.output,name="script"),
23 | url(r'^external', views.external),
24 | ]
25 |
26 |
--------------------------------------------------------------------------------
/html button external python script/buttonpython/buttonpython/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 | import requests
3 | import sys
4 | from subprocess import run,PIPE
5 | def button(request):
6 |
7 | return render(request,'home.html')
8 |
9 | def output(request):
10 | data=requests.get("https://www.google.com/")
11 | print(data.text)
12 | data=data.text
13 | return render(request,'home.html',{'data':data})
14 |
15 | def external(request):
16 | inp= request.POST.get('param')
17 | out= run([sys.executable,'//mnt//e//work//djnago_testing//test.py',inp],shell=False,stdout=PIPE)
18 | print(out)
19 |
20 | return render(request,'home.html',{'data1':out.stdout})
21 |
22 |
--------------------------------------------------------------------------------
/html button external python script/buttonpython/buttonpython/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for buttonpython project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "buttonpython.settings")
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/html button external python script/buttonpython/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hackanons/button-python-click/c76e27a97f3c1c1e8db070dcf3864e72798b3b15/html button external python script/buttonpython/db.sqlite3
--------------------------------------------------------------------------------
/html button external python script/buttonpython/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "buttonpython.settings")
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError:
10 | # The above import may fail for some other reason. Ensure that the
11 | # issue is really that Django is missing to avoid masking other
12 | # exceptions on Python 2.
13 | try:
14 | import django
15 | except ImportError:
16 | raise ImportError(
17 | "Couldn't import Django. Are you sure it's installed and "
18 | "available on your PYTHONPATH environment variable? Did you "
19 | "forget to activate a virtual environment?"
20 | )
21 | raise
22 | execute_from_command_line(sys.argv)
23 |
--------------------------------------------------------------------------------
/html button external python script/buttonpython/templates/home.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Python button script
6 |
7 |
8 |
9 |
10 | {% if data %}
11 |
12 | {{data | safe}}
13 |
14 | {% endif %}
15 |
16 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/html button external python script/test.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import datetime
3 |
4 |
5 | time=datetime.datetime.now()
6 |
7 | output="Hi %s currentadfwffffdwadwd time is %s" % (sys.argv[1],time)
8 |
9 | print(output)
10 |
11 |
--------------------------------------------------------------------------------