Unable to deploy flask app

Hi, I have not been able to deploy my flask app https://replit.com/@thercyl/ProductLaunches-v2#main.py. I encountered this error: The deployment failed to initialize due to a configuration or code error. Check the logs tab for more information. For additional support, please post on https://ask.replit.com/c/help/13 and a staff member will take a look.

I have been able to manually deploy it by clicking on the Run button. I’m using host=‘0.0.0.0’, port=80.

Pls help. Thank you.

Hi @thercyl , welcome to the forums!
Could you send the deployment logs of your program?
Also, the Run button doesn’t deploy the repl, it runs it in development mode.

3 Likes

here are the logs:

03/13/24 07:44:37 PM

* Running on http://127.0.0.1:80

03/13/24 07:44:37 PM

* Running on all addresses (0.0.0.0)

03/13/24 07:44:37 PM

e[31me[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.e[0m

03/13/24 07:44:37 PM

* Running on http://169.254.8.1:80

03/13/24 07:44:37 PM

e[33mPress CTRL+C to quite[0m

03/13/24 07:44:37 PM

* Debug mode: off

03/13/24 07:44:37 PM

* Serving Flask app 'main'

03/13/24 07:44:35 PM

forwarding local port 81 to external port 1104

03/13/24 07:44:34 PM

starting up user application
1 Like

That seems like your server is responding to an abnormal external port, is that intentional?

1 Like

no. i don’t know what forwarding local port 81 to external port 1104 means and what part of my code makes it do that. how do i fix it so that i can deploy my code?

That isn’t in your code, that can be configured in the networking tab.

2 Likes

This is how it is currently configured in the .replit file

[[ports]]
localPort = 80
externalPort = 3000

[[ports]]
localPort = 81
externalPort = 80

[[ports]]
localPort = 8080
externalPort = 8080
1 Like

Try removing the last two sections, which would make it like this:

[[ports]]
localPort = 80
externalPort = 3000
2 Likes