From 3525d7f2f8b2b87538487992c1c1dc8ef275cba8 Mon Sep 17 00:00:00 2001 From: Evgenii Akentev Date: Sat, 18 May 2019 23:01:18 +0300 Subject: [PATCH] setup heroku --- .gitignore | 27 ++++++++++++++++++- Procfile | 1 + app.py | 17 +++++++----- front/package-lock.json => package-lock.json | 0 front/package.json => package.json | 0 {front/public => public}/favicon.ico | Bin {front/public => public}/index.html | 0 {front/public => public}/manifest.json | 0 {front/public => public}/now.json | 0 {front/src => src}/404.js | 0 {front/src => src}/App.css | 0 {front/src => src}/AppLayout.js | 0 {front/src => src}/Game.js | 0 {front/src => src}/GameController.js | 0 {front/src => src}/Link.js | 0 {front/src => src}/Welcome.js | 0 {front/src => src}/api.js | 0 {front/src => src}/createMap.js | 0 {front/src => src}/img/sticker.webp | Bin {front/src => src}/index.css | 0 {front/src => src}/index.js | 0 {front/src => src}/logo.svg | 0 {front/src => src}/render.js | 0 {front/src => src}/router.js | 0 {front/src => src}/routes.js | 0 {front/src => src}/serviceWorker.js | 0 26 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 Procfile rename front/package-lock.json => package-lock.json (100%) rename front/package.json => package.json (100%) rename {front/public => public}/favicon.ico (100%) rename {front/public => public}/index.html (100%) rename {front/public => public}/manifest.json (100%) rename {front/public => public}/now.json (100%) rename {front/src => src}/404.js (100%) rename {front/src => src}/App.css (100%) rename {front/src => src}/AppLayout.js (100%) rename {front/src => src}/Game.js (100%) rename {front/src => src}/GameController.js (100%) rename {front/src => src}/Link.js (100%) rename {front/src => src}/Welcome.js (100%) rename {front/src => src}/api.js (100%) rename {front/src => src}/createMap.js (100%) rename {front/src => src}/img/sticker.webp (100%) rename {front/src => src}/index.css (100%) rename {front/src => src}/index.js (100%) rename {front/src => src}/logo.svg (100%) rename {front/src => src}/render.js (100%) rename {front/src => src}/router.js (100%) rename {front/src => src}/routes.js (100%) rename {front/src => src}/serviceWorker.js (100%) diff --git a/.gitignore b/.gitignore index 4ad6467..1a48e9e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] *$py.class +node_modules # C extensions *.so @@ -103,4 +104,28 @@ venv.bak/ # mypy .mypy_cache/ -.idea/ \ No newline at end of file +.idea/ + +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..2e35818 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: python app.py diff --git a/app.py b/app.py index d5e61b5..95f0c3b 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,5 @@ +import os from random import shuffle, random - from bottle import get, post, run, request, static_file, response import uuid from geo import distance, move_coordinate @@ -255,26 +255,29 @@ def finish_game(game_id): @get('/') @enable_cors def index(): - return static_file('index.html', "front/build") + return static_file('index.html', "build") @get('/static/css/') @enable_cors def static_css(staticFile): - return static_file(staticFile, "front/build/static/css") + return static_file(staticFile, "build/static/css") @get('/static/js/') @enable_cors def static_js(staticFile): - return static_file(staticFile, "front/build/static/js") + return static_file(staticFile, "build/static/js") @get('/static/media/') @enable_cors def static_media(staticFile): - return static_file(staticFile, "front/build/static/media") + return static_file(staticFile, "build/static/media") @get('/') @enable_cors def index(whatever): - return static_file('index.html', "front/build") + return static_file('index.html', "build") -run(host='localhost', port=8080, debug=True, server='paste') +if os.environ.get('APP_LOCATION') == 'heroku': + run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000))) +else: + run(host='localhost', port=8080, debug=True, server='paste') diff --git a/front/package-lock.json b/package-lock.json similarity index 100% rename from front/package-lock.json rename to package-lock.json diff --git a/front/package.json b/package.json similarity index 100% rename from front/package.json rename to package.json diff --git a/front/public/favicon.ico b/public/favicon.ico similarity index 100% rename from front/public/favicon.ico rename to public/favicon.ico diff --git a/front/public/index.html b/public/index.html similarity index 100% rename from front/public/index.html rename to public/index.html diff --git a/front/public/manifest.json b/public/manifest.json similarity index 100% rename from front/public/manifest.json rename to public/manifest.json diff --git a/front/public/now.json b/public/now.json similarity index 100% rename from front/public/now.json rename to public/now.json diff --git a/front/src/404.js b/src/404.js similarity index 100% rename from front/src/404.js rename to src/404.js diff --git a/front/src/App.css b/src/App.css similarity index 100% rename from front/src/App.css rename to src/App.css diff --git a/front/src/AppLayout.js b/src/AppLayout.js similarity index 100% rename from front/src/AppLayout.js rename to src/AppLayout.js diff --git a/front/src/Game.js b/src/Game.js similarity index 100% rename from front/src/Game.js rename to src/Game.js diff --git a/front/src/GameController.js b/src/GameController.js similarity index 100% rename from front/src/GameController.js rename to src/GameController.js diff --git a/front/src/Link.js b/src/Link.js similarity index 100% rename from front/src/Link.js rename to src/Link.js diff --git a/front/src/Welcome.js b/src/Welcome.js similarity index 100% rename from front/src/Welcome.js rename to src/Welcome.js diff --git a/front/src/api.js b/src/api.js similarity index 100% rename from front/src/api.js rename to src/api.js diff --git a/front/src/createMap.js b/src/createMap.js similarity index 100% rename from front/src/createMap.js rename to src/createMap.js diff --git a/front/src/img/sticker.webp b/src/img/sticker.webp similarity index 100% rename from front/src/img/sticker.webp rename to src/img/sticker.webp diff --git a/front/src/index.css b/src/index.css similarity index 100% rename from front/src/index.css rename to src/index.css diff --git a/front/src/index.js b/src/index.js similarity index 100% rename from front/src/index.js rename to src/index.js diff --git a/front/src/logo.svg b/src/logo.svg similarity index 100% rename from front/src/logo.svg rename to src/logo.svg diff --git a/front/src/render.js b/src/render.js similarity index 100% rename from front/src/render.js rename to src/render.js diff --git a/front/src/router.js b/src/router.js similarity index 100% rename from front/src/router.js rename to src/router.js diff --git a/front/src/routes.js b/src/routes.js similarity index 100% rename from front/src/routes.js rename to src/routes.js diff --git a/front/src/serviceWorker.js b/src/serviceWorker.js similarity index 100% rename from front/src/serviceWorker.js rename to src/serviceWorker.js -- 2.50.1