]> git.xn--bdkaa.com Git - where-are-you.py.git/commitdiff
setup heroku
authorEvgenii Akentev <i@ak3n.com>
Sat, 18 May 2019 20:01:18 +0000 (23:01 +0300)
committerEvgenii Akentev <i@ak3n.com>
Sat, 18 May 2019 20:40:01 +0000 (23:40 +0300)
26 files changed:
.gitignore
Procfile [new file with mode: 0644]
app.py
package-lock.json [moved from front/package-lock.json with 100% similarity]
package.json [moved from front/package.json with 100% similarity]
public/favicon.ico [moved from front/public/favicon.ico with 100% similarity]
public/index.html [moved from front/public/index.html with 100% similarity]
public/manifest.json [moved from front/public/manifest.json with 100% similarity]
public/now.json [moved from front/public/now.json with 100% similarity]
src/404.js [moved from front/src/404.js with 100% similarity]
src/App.css [moved from front/src/App.css with 100% similarity]
src/AppLayout.js [moved from front/src/AppLayout.js with 100% similarity]
src/Game.js [moved from front/src/Game.js with 100% similarity]
src/GameController.js [moved from front/src/GameController.js with 100% similarity]
src/Link.js [moved from front/src/Link.js with 100% similarity]
src/Welcome.js [moved from front/src/Welcome.js with 100% similarity]
src/api.js [moved from front/src/api.js with 100% similarity]
src/createMap.js [moved from front/src/createMap.js with 100% similarity]
src/img/sticker.webp [moved from front/src/img/sticker.webp with 100% similarity]
src/index.css [moved from front/src/index.css with 100% similarity]
src/index.js [moved from front/src/index.js with 100% similarity]
src/logo.svg [moved from front/src/logo.svg with 100% similarity]
src/render.js [moved from front/src/render.js with 100% similarity]
src/router.js [moved from front/src/router.js with 100% similarity]
src/routes.js [moved from front/src/routes.js with 100% similarity]
src/serviceWorker.js [moved from front/src/serviceWorker.js with 100% similarity]

index 4ad64672f26fdfeaec1fd7f5ce9d43c924ce6f4d..1a48e9e5a23236aa78c3091648dafc70cebb68e9 100644 (file)
@@ -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 (file)
index 0000000..2e35818
--- /dev/null
+++ b/Procfile
@@ -0,0 +1 @@
+web: python app.py
diff --git a/app.py b/app.py
index d5e61b5ec5b71cd942431903453e12b9fdde74dd..95f0c3b2396e4d2d3edbb457cc0b2f0209f0090b 100644 (file)
--- 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/<staticFile>')
 @enable_cors
 def static_css(staticFile):
-    return static_file(staticFile, "front/build/static/css")
+    return static_file(staticFile, "build/static/css")
 
 @get('/static/js/<staticFile>')
 @enable_cors
 def static_js(staticFile):
-    return static_file(staticFile, "front/build/static/js")
+    return static_file(staticFile, "build/static/js")
 
 @get('/static/media/<staticFile>')
 @enable_cors
 def static_media(staticFile):
-    return static_file(staticFile, "front/build/static/media")
+    return static_file(staticFile, "build/static/media")
 
 @get('/<whatever>')
 @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')
similarity index 100%
rename from front/package-lock.json
rename to package-lock.json
similarity index 100%
rename from front/package.json
rename to package.json
similarity index 100%
rename from front/public/favicon.ico
rename to public/favicon.ico
similarity index 100%
rename from front/public/index.html
rename to public/index.html
similarity index 100%
rename from front/public/now.json
rename to public/now.json
similarity index 100%
rename from front/src/404.js
rename to src/404.js
similarity index 100%
rename from front/src/App.css
rename to src/App.css
similarity index 100%
rename from front/src/AppLayout.js
rename to src/AppLayout.js
similarity index 100%
rename from front/src/Game.js
rename to src/Game.js
similarity index 100%
rename from front/src/Link.js
rename to src/Link.js
similarity index 100%
rename from front/src/Welcome.js
rename to src/Welcome.js
similarity index 100%
rename from front/src/api.js
rename to src/api.js
similarity index 100%
rename from front/src/createMap.js
rename to src/createMap.js
similarity index 100%
rename from front/src/index.css
rename to src/index.css
similarity index 100%
rename from front/src/index.js
rename to src/index.js
similarity index 100%
rename from front/src/logo.svg
rename to src/logo.svg
similarity index 100%
rename from front/src/render.js
rename to src/render.js
similarity index 100%
rename from front/src/router.js
rename to src/router.js
similarity index 100%
rename from front/src/routes.js
rename to src/routes.js