Skip to content

Commit 9317fe8

Browse files
committed
Initial commit
Created from https://vercel.com/new
0 parents  commit 9317fe8

File tree

5 files changed

+58
-0
lines changed

5 files changed

+58
-0
lines changed

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.vercel
2+
*.log
3+
*.pyc
4+
__pycache__
5+
6+
# Environments
7+
.env
8+
.venv
9+
env/
10+
venv/
11+
ENV/
12+
env.bak/
13+
venv.bak/

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fpython%2Fflask3&demo-title=Flask%203%20%2B%20Vercel&demo-description=Use%20Flask%203%20on%20Vercel%20with%20Serverless%20Functions%20using%20the%20Python%20Runtime.&demo-url=https%3A%2F%2Fflask3-python-template.vercel.app%2F&demo-image=https://assets.vercel.com/image/upload/v1669994156/random/flask.png)
2+
3+
# Flask + Vercel
4+
5+
This example shows how to use Flask 3 on Vercel with Serverless Functions using the [Python Runtime](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/python).
6+
7+
## Demo
8+
9+
https://flask3-python-template.vercel.app/
10+
11+
## How it Works
12+
13+
This example uses the Web Server Gateway Interface (WSGI) with Flask to enable handling requests on Vercel with Serverless Functions.
14+
15+
## Running Locally
16+
17+
```bash
18+
npm i -g vercel
19+
vercel dev
20+
```
21+
22+
Your Flask application is now available at `http://localhost:3000`.
23+
24+
## One-Click Deploy
25+
26+
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):
27+
28+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fpython%2Fflask3&demo-title=Flask%203%20%2B%20Vercel&demo-description=Use%20Flask%203%20on%20Vercel%20with%20Serverless%20Functions%20using%20the%20Python%20Runtime.&demo-url=https%3A%2F%2Fflask3-python-template.vercel.app%2F&demo-image=https://assets.vercel.com/image/upload/v1669994156/random/flask.png)

api/index.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
5+
@app.route('/')
6+
def home():
7+
return 'Hello, World!'
8+
9+
@app.route('/about')
10+
def about():
11+
return 'About'

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Flask==3.0.0

vercel.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rewrites": [
3+
{ "source": "/(.*)", "destination": "/api/index" }
4+
]
5+
}

0 commit comments

Comments
 (0)