for some reason i can't reach flask even though it should be exposed via the generated url

12 Replies
Percy
Percy6mo ago
Project ID: 2791af8d-2889-4ea7-9e78-a3f82ffadf69
celebrations
celebrations6mo ago
2791af8d-2889-4ea7-9e78-a3f82ffadf69
Brody
Brody6mo ago
please use gunicorn
celebrations
celebrations6mo ago
what is that
celebrations
celebrations6mo ago
can i deploy that on railway?
Brody
Brody6mo ago
of course, I wouldn't be asking you to use it otherwise
celebrations
celebrations6mo ago
i can't find a template for it how do i deploy it?
Brody
Brody6mo ago
please reference this template https://github.com/railwayapp-templates/flask
celebrations
celebrations6mo ago
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)
Brody
Brody6mo ago
there's more to that repo that it's main.py file
celebrations
celebrations6mo ago
ic im trying it with the procfile