help please
artwearshop
HOBBYOP

8 months ago

Dear Railway Support,

I am trying to deploy a Flask application using Waitress on Railway. However, I am still seeing the warning message indicating that the app is running on the development server even though I have followed all necessary steps for deploying a production server. Here’s a summary of the steps I have taken:

  1. Procfile Configuration:
    I created a Procfile in the root directory of my project with the following content:

    less

    ZkopírovatUpravit

    web: waitress-serve --host=0.0.0.0 --port=$PORT app:app

    This should allow Waitress to serve the Flask application in production.

  2. requirements.txt:
    In requirements.txt, I ensured that waitress is listed as a dependency:

    ini

    ZkopírovatUpravit

    waitress==3.0.2

  3. App Configuration:
    I updated my app.py to correctly initialize and configure the Flask app, making sure that the app is ready for deployment using a WSGI server.

  4. Deployment Steps:

    • I pushed the changes to GitHub.

    • I deployed the project to Railway using git push origin main.

  5. Problem:
    After deployment, I still see the warning:

    pgsql

    ZkopírovatUpravit

    WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.

    Additionally, the application seems to be running on the Flask development server, not Waitress or any production server.

Next Steps:

  • I have verified that Waitress is included in requirements.txt and that Procfile is correctly set.

  • I’ve redeployed the app multiple times, but the issue persists.

Could you please assist in ensuring that Waitress is correctly used as the production WSGI server in my Railway deployment?

Thank you for your help!

Best regards,

George

Closed$10 Bounty

2 Replies

chandrika
EMPLOYEE

8 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open chandrika 9 months ago


lofimit
HOBBY

8 months ago

Could you verify to me if your app.py file has this at the bottom:

if __name__ == '__main__':
    app.run(debug=True)  # This starts Flask's dev server

If yes, remove or comment out any app.run() calls in your code. Your app.py should end with just the Flask app definition, not any calls to run it.

If not, verify your Railway deployment logs show "Starting process with command waitress-serve --host=0.0.0.0 --port=$PORT app:app", and if not, there might be a Procfile issue. (The file must be named exactly "Procfile" and placed on the Project's root)



Status changed to Closed chandrika 9 months ago


Loading...