IssaKass
IssaKass
RRailway
Created by IssaKass on 1/31/2024 in #✋|help
This site can’t be reached, took too long to respond
No description
32 replies
RRailway
Created by IssaKass on 1/15/2024 in #✋|help
Flask deployment Crash
I recently deployed a Flask backend app to railway, and It crashed. This is the main.py:
# """Main script to run the Flask application."""

import os
from flask_cors import CORS
from flask import Flask, jsonify
from flask_migrate import Migrate
from config import get_config
from api.extensions import db, jwt
from api.routes import auth_bp, users_bp, projects_bp, subscriptions_bp

app = Flask(__name__)

CORS(app)

# # Load configuration based on the specified environment
flask_env = os.getenv("FLASK_ENV")
app.config.from_object(get_config(flask_env))


@app.route("/")
def index():
return jsonify(
{
"ENV": flask_env,
"DEBUG": app.config["DEBUG"],
"TESTING": app.config["TESTING"],
"SECRET_KEY": app.config["SECRET_KEY"],
"JWT_SECRET_KEY": app.config["JWT_SECRET_KEY"],
"SQLALCHEMY_DATABASE_URI": app.config["SQLALCHEMY_DATABASE_URI"],
}
)


# Initialize the database extension
db.init_app(app)

# Initialize the migration extension
Migrate(app, db)

# Initialize the JWT extension
jwt.init_app(app)

# Register the blueprints with a specified prefix
app.register_blueprint(auth_bp)
app.register_blueprint(users_bp)
app.register_blueprint(projects_bp)
app.register_blueprint(subscriptions_bp)


if __name__ == "__main__":
app.run(debug=True, port=os.getenv("PORT", default=5000))
# """Main script to run the Flask application."""

import os
from flask_cors import CORS
from flask import Flask, jsonify
from flask_migrate import Migrate
from config import get_config
from api.extensions import db, jwt
from api.routes import auth_bp, users_bp, projects_bp, subscriptions_bp

app = Flask(__name__)

CORS(app)

# # Load configuration based on the specified environment
flask_env = os.getenv("FLASK_ENV")
app.config.from_object(get_config(flask_env))


@app.route("/")
def index():
return jsonify(
{
"ENV": flask_env,
"DEBUG": app.config["DEBUG"],
"TESTING": app.config["TESTING"],
"SECRET_KEY": app.config["SECRET_KEY"],
"JWT_SECRET_KEY": app.config["JWT_SECRET_KEY"],
"SQLALCHEMY_DATABASE_URI": app.config["SQLALCHEMY_DATABASE_URI"],
}
)


# Initialize the database extension
db.init_app(app)

# Initialize the migration extension
Migrate(app, db)

# Initialize the JWT extension
jwt.init_app(app)

# Register the blueprints with a specified prefix
app.register_blueprint(auth_bp)
app.register_blueprint(users_bp)
app.register_blueprint(projects_bp)
app.register_blueprint(subscriptions_bp)


if __name__ == "__main__":
app.run(debug=True, port=os.getenv("PORT", default=5000))
==> crashed at line 35: db.init_app(app)
194 replies
RRailway
Created by IssaKass on 1/15/2024 in #✋|help
Flask deployment crashed
No description
45 replies
RRailway
Created by IssaKass on 1/13/2024 in #✋|help
Question about environment variables
I have a question about Railway environment variables. I am deploying a flask app with postgresql to Railway App, and setting up env variables. Does these variables depends on the variables that are used while developing the app? Or vice versa?
13 replies
RRailway
Created by IssaKass on 1/13/2024 in #✋|help
Add Postgres To Flask
No description
54 replies
RRailway
Created by IssaKass on 1/9/2024 in #✋|help
Flask + React deployment
I have a flask + react app that is running locally. How would I deploy it to Railway? I tried to have 2 services, one for the frontend and the other for the backend, but the frontend was unable to fetch data from the backend returning with: unexpected token < JSON. The backend is working and I tested it via postman. Projet id: c6894929-c040-4842-8c83-4516d57a14fe
68 replies