summaryrefslogtreecommitdiff
path: root/frontend/imdither/run.py
blob: 3fed4294e1d610e0afd4841d6be5abcfcff68c4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python2.7
from bottle import route, run, static_file, request
import makeDither
import urlDownload

@route('/')
def server_static():
      return static_file("imdither.html", root='./')

@route('/dithers/<filename>')
def server_static(filename):
      return static_file(filename, root='./dithers/')

@route('/img/<filename>')
def server_static(filename):
      return static_file(filename, root='./img/')

@route('/<filename>')
def server_static(filename):
      return static_file(filename, root='./')

@route('/process', method='POST')
def process_image():
       url = request.forms.get('url')
       params = request.forms.get('params')
       download = urlDownload.UrlDownload(url)
       tempfile = download.dir + download.filename
       makeDither.Dither(tempfile)

@route('/status', method='GET')
def show_status():
  pass
#run(host='0.0.0.0', port=4111, debug=True)
run(server='flup', host='localhost', port=4111, debug=True)