Flask not working

Hi I have my project and when I deploy it theres no errors but when i go onto the website where its being hosted I get server error but I have my app.run like this app.run(port=5000)
No description
P
Percy17d ago
Project ID: a456ed59-7ab2-4b5a-bfdf-4717e08317e9
J
je17d ago
a456ed59-7ab2-4b5a-bfdf-4717e08317e9
L
LaCrak2717d ago
Dev server detected!
J
je17d ago
thats why?
F
Fragly17d ago
Your app needs to use 0.0.0.0 as the host ( like the message box at the top says ) You're also running a development server, you'll want to use gunicorn to run your server to do that, add gunicorn to requirements.txt your start command would look something like this gunicorn main:app -b [::]:5000 ( you can set it in service settings )
J
je17d ago
alright let me try it
B
Brody17d ago
gunicorn main:app
gunicorn main:app
will suffice in most cases
J
je17d ago
No description
J
je17d ago
so yea i did both of what you guys told me into my start command and it gives out this it worked but I have a discord bot with it but its not loaded?
J
je17d ago
right here before it said discord logging in
B
Brody17d ago
a discord bot with a flask app? may i ask why?
J
je17d ago
because im hosting a dashboard with it also and this will really help me out
B
Brody17d ago
you would need to start the discord bot in async mode
J
je17d ago
ah I have it like this
def run_flask():
app.run(port=5000)


def run_discord():
bot.run(TOKEN)

if __name__ == "__main__":
flask_thread = threading.Thread(target=run_flask)
discord_thread = threading.Thread(target=run_discord)
flask_thread.start()
discord_thread.start()
flask_thread.join()
discord_thread.join()
def run_flask():
app.run(port=5000)


def run_discord():
bot.run(TOKEN)

if __name__ == "__main__":
flask_thread = threading.Thread(target=run_flask)
discord_thread = threading.Thread(target=run_discord)
flask_thread.start()
discord_thread.start()
flask_thread.join()
discord_thread.join()
how do i fix it?
B
Brody17d ago
Im sorry but we wouldnt be able to offer coding help here, these help threads are meant to provide platform help
J
je17d ago
ah okay
B
Brody17d ago
get it working locally with gunicorn and then we can can pick back up on this
J
je17d ago
isnt it already
J
je17d ago
No description
B
Brody17d ago
is the discord bot running?
J
je17d ago
nope
B
Brody17d ago
then my statement stands
J
je17d ago
okay may you please help out, i still dont understand how gunicorn is blocking it
B
Brody17d ago
Im sorry but we wouldnt be able to offer coding help here, these help threads are meant to provide platform help
J
je17d ago
yea i see why now when i remove gunicorn main:app from the start command it goes back to dev and loads the discord bot
B
Brody17d ago
you need to use gunicorn to run the flask app when on railway
J
je17d ago
do you know how i can allow the discord bot also?
B
Brody17d ago
again, sorry but we would not be able to offer code help here
J
je17d ago
no im asking what else do i put on the start command
B
Brody17d ago
nothing to do with the start command, this would be a code issue
Want results from more Discord servers?
Add your server
More Posts
How can I include two executables?My NodeJS project needs Deno as well (to execute customer code in a sandbox). I can write a DockerfiPossible Security Attack RedisHi, my redis is showing this logs: Possible SECURITY ATTACK detected. It looks like somebody is sendHow to support both grpc and http for a railway service?I'm trying to set up weaviate on railway. Since their migration to the v4 client, I cannot instantiaInstalling dependencies for sub directoriesMy project have this structure ``` root/ ├── client/ (React app) | ├── .env | ├── .paFetching a file hosted on Filebrowser via Private NetworkSo I currently have a file that I am hosting using Filebrowser template. The file has a download lierror 13when i run "railway up" in the terminal of my project it says Permission denied (os error 13)Transferring a service from one project to anotherHow Can i transfer a service from a project to another project. it's a mysql database so i can't reIssue when deploying node app using dockerI'm having issues when I'm trying to deploy a node app with docker, when I build and run the image lFastAPI service health-check fails in IPV6I'm running a fastAPI service in railway. I setup a `/healthcheck` endpoint. It worked well when I eServer Response too slowI have Django, React application live on railway. I'm using Hobby plan. whenever I click through pDown only in DubaiHi Railway, Starting around 7.30 PM UTC +4, we can’t access our production instances. The URL is zeApplying chance is persistingI have this popup constantly appearing, even though nothing is being updated / changed. Anyway to geMySQL Memory UsageHey there, we just migrated to Railway and in the last 24h I saw that the memory usage is consistentRailway crashed after errors on trycatch?Is there any parameter to change in Railway so that it doesn't crash? because I'm using a trycatch tRailway having trouble connecting to local db upon deploymentHi. I recently deployed my node.js app on Railway and found out that during startup of my node.js apRedeploying service doesnt use updated Source Repo URLHi im new to railway so maybe this is a misunderstanding. I have started a project using a template rust deploy uses 10x more ram than local devhey guys, i have a rust api that is using 4-8gb of ram suddenly, now for rust that's unheard of conUnique variables for replicasHow can I assign a different token environment variable to each replica? Or have the replicas chooseDelete Strapi build and .cache foldersHello, how can I get a list of files in my railway project? I tried the command `railway run ls` buUnable to add repository to service that I'm a collaborator onI'm a collaborator on a github repo, and I'm trying to deploy a service on railway using that repo.