Skip to content

Commit

Permalink
vercel-build-not-working
Browse files Browse the repository at this point in the history
  • Loading branch information
jookie committed Sep 15, 2024
1 parent 0a4c4b7 commit 4d868a7
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
Empty file added examples/PY/index.py
Empty file.
43 changes: 43 additions & 0 deletions examples/PY1/index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from flask import Flask, request, jsonify # Import the Flask class from the flask module and other necessary modules
import time # Example module to simulate processing time
from flask_cors import CORS # This is the only new import # Import the Flask class from the flask module and other necessary modules


app = Flask(__name__) # Create a Flask app
CORS(app) # This will enable CORS for all routes

# Define a route
@app.route('/your-endpoint')
def your_function():
data = {"message": "Hello, world! ferom your-endpoint"}
return jsonify(data)

@app.route('/run-script', methods=['POST'])
def run_script():
data = request.json.get('data')
# Simulate running a Python script (replace this with your actual logic)
time.sleep(2) # Simulating a delay
result = f'Processed data: {data}' # Example response

return jsonify({'message': result})


@app.route('/')
def home():
return 'Hello, From The Home route World!'

@app.route('/about')
def about():
return 'About'

# Users/dovpeles/workspace/jojobot/py/greet.py

# from finrl.config_tickers import DOW_30_TICKER
# print(DOW_30_TICKER)
from datetime import datetime
now = datetime.now()
formatted_time = now.strftime("%Y-%m-%d %H:%M:%S")
print(f"Hello from greet.py at {formatted_time}")

if __name__ == '__main__':
app.run(debug=True)
2 changes: 2 additions & 0 deletions examples/PY1/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask - CORS
flask
15 changes: 15 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": 2,
"builds": [
{
"src": "index.py",
"use": "@vercel/python"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "index.py"
}
]
}

0 comments on commit 4d868a7

Please sign in to comment.