I have decided to use github action to display my web page and format it using Python Flask, but I can't get it to work... everything works fine, there are no errors and flask stays listening on the production port (0.0.0.0), but it seems that it doesn't listen to anything, I go to the url of the github page that I made and nothing, as if it wasn't listening to anything or sending requests.
Here is my YML code:
name: page
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
push:
branches:
- main
permissions:
contents: "write"
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: production
steps:
- name: Installing dependencies
run: python -m pip install Flask
- run: echo "Iniciando..."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "Creando servidor..."
- name: Init server
run: python "${{ github.workspace }}/server.py"
Here is my Python code:
from flask import Flask, request, Blueprint, render_template;
app = Flask(__name__);
DEBUG=False;
#Registramos una nueva url
media_pt=Blueprint("media", __name__, static_folder="./media", static_url_path="/media");
app.register_blueprint(media_pt);
media_pt=Blueprint("static", __name__, static_folder="./static", static_url_path="/static");
app.register_blueprint(media_pt);
@app.route("/")
def index():
return render_template("index.html");
@app.route("/ok")
def is_of():
return "is okk";
if __name__=="__main__":
app.run(host="0.0.0.0",debug=DEBUG)
At first, regardless of the fact that the github page gave me a 404 error, now that I configure the root of the project it only returns the readme file (for not getting the index.html (I placed it in the template folder))
Copied from the comment.
So in no way those two support your attempt to host a Flask web app.
To resolve this, you usually have to pay for the right hosting platform.