Hi everyone,
I have successfully deployed on Flask application on Gcloud (at least there are no errors within the build logs) however, when I am trying to access the deployed URL, I am getting the following error:
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
It has been two days, I am stuck with this issue and any help will be really appreciated.
my app.yaml:
runtime: custom
env: flex
resources:
cpu: 4
memory_gb: 16
disk_size_gb: 30
manual_scaling:
instances: 1
entrypoint: gunicorn -b :$PORT app:app
Dockerfile:
Use an official base image from Docker Hub
FROM python:3.12
Set the working directory inside the container
WORKDIR /prod
Copy the local contents into the container at /app
COPY . /prod
Install dependencies (if needed) using pip or package manager
RUN pip install -r requirements.txt
Expose the port on which the application will run
EXPOSE 8080
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 app:app
and my app.py is :
from flask import Flask, request, jsonify
from flask_cors import CORS
from querying import answer_query
app = Flask(name)
CORS(app)
@app.route(‘/ask’, methods=[‘GET’])
def ask():
query = request.args.get(‘query’)
if not query:
return jsonify({“error”: “No query provided”}), 400
response = answer_query(query)
return jsonify(response)
if name == ‘main’:
app.run(host = ‘0.0.0.0’, port = 8080, debug=True)
Please help
Thanks