diff --git a/.gitignore b/.gitignore index e313e80..ec156a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ env/ +build/ +dist/ .workon .epio-app *.pyc diff --git a/README.md b/README.md index e22cbb0..e91a23f 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,20 @@ All endpoint responses are JSON-encoded. "url": "http://httpbin.org/get?show_env=1" } +## Installing and running from PyPI + +You can install httpbin as a library from PyPI and run it as a WSGI app. For example, using Gunicorn: + +```bash +$ pip install httpbin +$ gunicorn httpbin:app +``` + +## Changelog + +* 0.1.1: Added templates as data in setup.py +* 0.1.0: Added python3 support and (re)publish on PyPI + ## AUTHOR A [Kenneth Reitz](http://kennethreitz.com/pages/open-projects.html) diff --git a/httpbin/core.py b/httpbin/core.py index 49837dd..7404260 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -40,7 +40,10 @@ ENV_COOKIES = ( # Prevent WSGI from correcting the casing of the Location header BaseResponse.autocorrect_location_header = False -app = Flask(__name__) +# Find the correct template folder when running from a different location +tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') + +app = Flask(__name__, template_folder=tmpl_dir) # ----------- diff --git a/setup.py b/setup.py index 9044a05..fcad918 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ import re setup( name="httpbin", - version="0.1.0", + version="0.1.1", description="HTTP Request and Response Service", # The project URL. @@ -28,5 +28,6 @@ setup( 'Programming Language :: Python :: 3.4', ], packages=find_packages(), + include_package_data = True, # include files listed in MANIFEST.in install_requires=['Flask','MarkupSafe','decorator','itsdangerous','six'], )