Skip to content

Commit

Permalink
vercel deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCutestCat committed Aug 27, 2024
1 parent a3602e6 commit 6b15242
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
26 changes: 26 additions & 0 deletions api/streamlit_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from pathlib import Path
import streamlit as st
from streamlit.web.bootstrap import run

def streamlit_app():
# 这里导入并运行您的主 Streamlit 应用
import superexcel.main

async def asgi_app(scope, receive, send):
if scope["type"] == "http":
run(streamlit_app, "", [], flag_options={})
return
await send({
"type": "http.response.start",
"status": 200,
"headers": [
[b"content-type", b"text/plain"],
],
})
await send({
"type": "http.response.body",
"body": b"Hello, World!",
})

# 这个变量名很重要,Vercel 会查找它
app = asgi_app
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.10
19 changes: 19 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 2,
"builds": [
{
"src": "superexcel/main.py",
"use": "@vercel/python",
"config": { "maxLambdaSize": "15mb" }
}
],
"routes": [
{
"src": "/(.*)",
"dest": "superexcel/main.py"
}
],
"env": {
"PYTHONPATH": "/var/task"
}
}

0 comments on commit 6b15242

Please sign in to comment.