Alright, got around to doing some experimentation tonight and I got a core example working. I'll quickly document what I did here for any others to get up and running.
First I setup folders/files in my main directory.
home
xxxxxx
app_hug
app
__init__.py
venv
I created a python3 virtualenv into the venv folder.
Using the console with the venv activated I installed Hug. (note xxxxxx is your username)
I populated the init.py with some example code from the hug.rest Quickstart:
"""First hug API (HTTP access)"""
import hug
@hug.get(examples='name=Timothy&age=26')
def happy_birthday(name: hug.types.text, age: hug.types.number, hug_timer=3):
"""Says happy birthday to a user"""
return {'message': 'Happy {0} Birthday {1}!'.format(age, name),
'took': float(hug_timer)}
Following that I jumped to the web tab on PA and setup a web application with Python3.5 and manual WSGi file. I pointed the source directory to my source. I pointed the virtualenv to the venv folder
/home/xxxxxx/app_hug/venv
Finally I edited the WSGI config file. It looks similar to the below after deleting out the comments).
# +++++++++++ CUSTOM WSGI +++++++++++
import sys
path = '/home/xxxxxx/app_hug'
if path not in sys.path:
sys.path.append(path)
from app import __hug_wsgi__ as application
With all files saved, the final thing to do is to reload the web app. Once reloaded, you should be able to navigate to your URL and see a 404 page served with information on the rest API. You can query the example API too.
I'm just getting into Hug and learning it, so I haven't done any sort of load testing or performance checks. I'm glad I have PA to make it easy to serve and try this.