python Flask 입력받은 커맨드를 실행해주는 어플리케이션
2017. 12. 17. 02:31
연습삼아 만든 Flask 웹 어플리케이션
#!/usr/bin/python
# coding: utf-8
import commands
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
body = """the Site for running your command"""
return body
@app.route('/command/')
@app.route('/command/<cmd>')
def command(cmd=None):
if cmd != None:
output = commands.getstatusoutput(cmd)[1]
return output
else :
return "Please input your command"
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True)
ㅁㄴㅇㄹ
'Codes > Python' 카테고리의 다른 글
| 백준 1018번 체스판 다시 칠하기 write-up (0) | 2020.04.03 |
|---|---|
| 파이썬 가비지컬렉션 (0) | 2020.02.07 |
| ImportError: No module named yaml (0) | 2018.01.20 |
| 파이썬 코딩 컨벤션 (0) | 2017.05.06 |
| 디미고 합격 여부 확인하는 프로그램(v 1.1) (0) | 2016.11.13 |