mirror of
https://github.com/makefu/bump.git
synced 2024-03-22 11:32:52 +01:00
add gunicorn support
This commit is contained in:
parent
8a0f30785a
commit
1521fa463e
3 changed files with 11 additions and 8 deletions
|
@ -14,4 +14,4 @@ It is written as a replacement for the gorgeous sprunge.us
|
|||
|
||||
. bin/activate
|
||||
cd bump
|
||||
python init.py
|
||||
gunicorn -b 127.0.0.1:4000 init:app
|
||||
|
|
16
bump/init.py
16
bump/init.py
|
@ -1,11 +1,10 @@
|
|||
from flask import Flask, Response, request, send_from_directory
|
||||
from functools import wraps
|
||||
import sys
|
||||
import random
|
||||
import string
|
||||
import os
|
||||
app = Flask(__name__)
|
||||
storedir = os.path.join(app.root_path, 'store'),
|
||||
storedir = os.path.join(app.root_path, 'store')
|
||||
app.config['storedir'] = storedir
|
||||
|
||||
|
||||
|
@ -25,10 +24,13 @@ def usage(host):
|
|||
< balls
|
||||
Source at http://github.com/makefu/bump""".format(host)
|
||||
|
||||
|
||||
@app.route('/favicon.ico')
|
||||
def favicon():
|
||||
return send_from_directory(os.path.join(app.root_path, 'static'),
|
||||
'favicon.ico', mimetype='image/vnd.microsoft.icon')
|
||||
'favicon.ico',
|
||||
mimetype='image/vnd.microsoft.icon')
|
||||
|
||||
|
||||
@returns_plain
|
||||
@app.route("/", methods=["GET"])
|
||||
|
@ -63,11 +65,11 @@ def retrieve_file(key):
|
|||
def store(key, value):
|
||||
with open("%s/%s" % (storedir, key), "wb+") as f:
|
||||
try:
|
||||
# py3
|
||||
f.write(bytes(value, "UTF-8"))
|
||||
# py3
|
||||
f.write(bytes(value, "UTF-8"))
|
||||
except:
|
||||
# py2
|
||||
f.write(value)
|
||||
# py2
|
||||
f.write(value)
|
||||
|
||||
|
||||
def retrieve(key):
|
||||
|
|
1
deps.txt
1
deps.txt
|
@ -3,4 +3,5 @@ Jinja2==2.7.1
|
|||
MarkupSafe==0.18
|
||||
Werkzeug==0.9.4
|
||||
distribute==0.6.31
|
||||
gunicorn==18.0
|
||||
itsdangerous==0.23
|
||||
|
|
Loading…
Reference in a new issue