-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a lightweight service for hosting on Heroku.
- Loading branch information
1 parent
0b60838
commit 64a6bcd
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[[source]] | ||
|
||
url = "https://pypi.python.org/simple" | ||
verify_ssl = true | ||
|
||
|
||
[packages] | ||
|
||
python-dateutil = "*" | ||
django = "*" | ||
django-heroku = "*" | ||
Flask = "*" | ||
gunicorn = "*" | ||
pytest = "*" | ||
|
||
|
||
[requires] | ||
|
||
python_version = "3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: gunicorn --pythonpath service service:app --log-file=- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright (C) 2015-2019 InSeven Limited. | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
||
import logging | ||
import os | ||
|
||
from flask import Flask, escape, request, jsonify, send_from_directory, g, make_response, redirect | ||
|
||
|
||
ROOT_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
logging.basicConfig(level=logging.INFO, format="[%(asctime)s] [%(process)d] [%(levelname)s] %(message)s", datefmt='%Y-%m-%d %H:%M:%S %z') | ||
|
||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
def index(): | ||
return send_from_directory(ROOT_DIRECTORY, 'index.html') | ||
|
||
|
||
@app.route('/<path:path>') | ||
def everything_else(path): | ||
return send_from_directory(ROOT_DIRECTORY, path) | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0') |