This repository contains a simple Flask application and instructions for deploying it on Vercel.
This Flask application serves a basic "Hello World!" response.
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
To deploy this Flask application on Vercel, follow these steps:
-
A Vercel account. Sign up at Vercel.
-
Vercel CLI installed. You can install it using npm:
npm install -g vercel
-
Fork or Clone the Repository:
-
Fork this repository or clone it to your local machine.
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
-
Create a
vercel.json
File:-
Create a
vercel.json
file in the root directory of your project with the following content:{ "version": 2, "builds": [ { "src": "app.py", "use": "@vercel/python" } ], "routes": [ { "src": "/(.*)", "dest": "app.py" } ] }
-
-
Login to Vercel:
-
Log in to your Vercel account using the Vercel CLI.
vercel login
-
-
Deploy the Application:
-
Deploy your application to Vercel.
vercel
-
-
Follow the Prompts:
- Follow the prompts to complete the deployment. Vercel will ask for the project name, the directory containing your project, and other settings. Accept the default settings or customize as needed.
-
Access Your Deployed Application:
- After deployment is complete, Vercel will provide you with a URL where your Flask application is live.
- Ensure that your
requirements.txt
file lists all necessary dependencies for your Flask application. - For more advanced configurations, refer to the Vercel documentation.
Unlicensed