Did I use the wrong Framework Preset? Do I need to change something in my repository?
I would greatly appreciate any help!
Vercel Alum
Hi and welcome to the community, !
The error you're encountering indicates that Vercel is expecting a web application handler (either handler or app) to be defined in your main.py. The provided script appears to be generating a static HTML file, rather than running a web server.
To resolve this, you can use a simple web framework like Flask to serve your generated HTML.
You would need to specify the following in your requirements.txt:
Flask==2.1.1
Then you'd need to import Flask and define Flask App in you main.py. Something like:
from flask import Flask, render_template_string
app = Flask(__name__)
And create Flask Route to Serve HTML.
@app.route("/")
def index():
And serve the application with Flask.
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8000)
from datetime import datetime
import toml # type: ignore
from jinja2 import Environment, FileSystemLoader # type: ignore
These changes convert the script from generating a static HTML file to serving the HTML via a Flask web application, allowing it to be deployed on Vercel.
I've also linked related documentation from Flask in case it's helpful: