Skip to content

Instantly share code, notes, and snippets.

@m-ueno
Last active February 6, 2017 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-ueno/0ec3922c30c37424f13bcaecc98ab4db to your computer and use it in GitHub Desktop.
Save m-ueno/0ec3922c30c37424f13bcaecc98ab4db to your computer and use it in GitHub Desktop.
import hug
from hug.api import API
from logging import getLogger, StreamHandler, DEBUG, INFO
from werkzeug.wsgi import DispatcherMiddleware
from flask import Flask
from flask.ext.autoindex import AutoIndex
API(__name__) # __hug_wsgi__ special variable becomes accessible below this line
# autoindex current dir
app_index = Flask(__name__)
AutoIndex(app_index, browse_root=os.path.curdir)
# expose WSGI app
app = DispatcherMiddleware(app_index, {
'/static': app_index,
'': __hug_wsgi__,
})
@hug.get('/hello')
def hello():
return 'hello'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment