#Exposing the app

17 messages · Page 1 of 1 (latest)

rare stratus
#

I deployed my first flask app in railway. But soon after my app is crashed. It seems that I need to expose my app by giving a port variable or so. Would you please show me the way, how I can make my app live?

tawny cargoBOT
#

Project ID: N/A

#

The easiest way to get up and running is to have your application listen on 0.0.0.0:$PORT, where PORT is a Railway-provided environment variable. Alternatively, you can manually override the PORT environment variable by adding PORT to your projects variables page. (Command + K and type Variables or you can use the keyboard shortcut: G + V under your selected project).

rare stratus
#

When I write PORT : 0.0.0.0 under variables and try to redeploy my app, I get the error meassge that the variable should be an integer. Would you give me the exact notation?

cold rampart
#

show me the bit of code that starts the flask server please

rare stratus
#

if name == 'main':
app.run(debug=True, port=os.getenv("PORT", default=5000)

cold rampart
rare stratus
#

I've got this bit of code from railway's flask template anyway

#

And put it in my code

cold rampart
#

your code is different, "name" is not defined

#

also missing a closing parentheses but i think thats just a copying mistake when you sent it here

rare stratus
#

Is the "main" here comes from the main.py?

cold rampart
#

its supposed to be "name"

#

oh

#

discord is removing the underscores on code that isn't code formatted, so lets just see a screenshot of the deploy logs

rare stratus
#

Ok Brody
But first : The parantheses is not copy-paste mistake. It is missing in my code too. Let me first correct this and try. If the problem persists. I write again

#

It worked Brody Thanks. It is that missing paranthesisi