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

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