for some reason i can't reach flask even though it should be exposed via the generated url
12 Replies
Project ID:
2791af8d-2889-4ea7-9e78-a3f82ffadf69
2791af8d-2889-4ea7-9e78-a3f82ffadf69
please use gunicorn
what is that
can i deploy that on railway?
of course, I wouldn't be asking you to use it otherwise
i can't find a template for it
how do i deploy it?
please reference this template https://github.com/railwayapp-templates/flask
thats literally almost the same as my code
from flask import Flask, request, jsonify
from time import sleep
from openai import OpenAI
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv('OPENAI_API_KEY')
client = OpenAI(api_key=api_key)
def generate_response(data):
app = Flask(name) @app.route('/echo', methods=['POST']) def echo(): print("echo") data = request.json email = generate_response(data) return jsonify({ 'message': email }) @app.route('/create', methods=['POST']) def create(): print("create") data = request.json email = generate_response(data) return jsonify({ 'message': email }) if name == 'main': port = int(os.getenv('PORT', 5000)) app.run(debug=True, port=port)
app = Flask(name) @app.route('/echo', methods=['POST']) def echo(): print("echo") data = request.json email = generate_response(data) return jsonify({ 'message': email }) @app.route('/create', methods=['POST']) def create(): print("create") data = request.json email = generate_response(data) return jsonify({ 'message': email }) if name == 'main': port = int(os.getenv('PORT', 5000)) app.run(debug=True, port=port)
there's more to that repo that it's main.py file
ic
im trying it with the procfile