The static files work fine but for some reason the entrypoint isn't running at all. I've even tried making running start.sh as an entrypoint with an echo "Starting gunicorn" and I don't see it in the logs. It's not my code I'm pretty sure since I've tested locally. This worked before when I didn't use gunicorn.
app.yaml:
runtime: python39
entrypoint: gunicorn --worker-class eventlet -t 4 -w 1 --timeout 120 main:app -b :$PORT
manual_scaling:
instances: 1
network:
session_affinity: true
handlers:
# API handlers
- url: /api/.*
script: auto
secure: always
redirect_http_response_code: 301
# Static file handlers
- url: /(.*\.(html|css|js|png|jpg|jpeg|gif|ico|json|webp|svg))
static_files: frontend/dist/\1
upload: frontend/dist/(.*\.(html|css|js|png|jpg|jpeg|gif|ico|json|webp|svg))
secure: always
# Catch-all handler for other static files and single-page app support
- url: /.*
static_files: frontend/dist/index.html
upload: frontend/dist/index.html
secure: always
I was expecting the API/script and the static frontend to work but for some reason only the static files are working.
SOLVED: I found out that there was something wrong with the route handling and I started hosting the static files on Python. Since it was an SPA my handler looked like this:
# Catch-all for SPA
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
if re.match("(.*\.(html|css|js|png|jpg|jpeg|gif|ico|json|webp|svg))", path):
return app.send_static_file(path)
return app.send_static_file("index.html")
SOLVED: I found out that there was something wrong with the route handling and I started hosting the static files on Python. Since it was an SPA my handler looked like this:
# Catch-all for SPA
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
if re.match("(.*\.(html|css|js|png|jpg|jpeg|gif|ico|json|webp|svg))", path):
return app.send_static_file(path)
return app.send_static_file("index.html")
``
Thanks to NoCommandLine for helping me out.