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

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