Deployments Fail - Not Sure Why (I'm an Absolute Beginner)

Hello, I have been using Heroku as an easy-to-use source for hosting some of my personal Python (Plotly Dash) apps. Due to Heroku ending its free services later this year, I’ve been looking for free alternative to storing my apps (I’ve got 5).

I found and it looked like it was going to be fairly straight forward. Before trying to deploy any of 5 Python apps, I tried to deploy the sample Python Flask app they have on their website. However, the deployment failed, but didn’t give me a clear reason why. Even the troubleshooting page didn’t seem to help or maybe I didn’t know how to use it.

Here is a screenshot of my terminal window output:

To my knowledge, I didn’t choose any weird settings. I did notice that the contents of the fly.toml file that was automatically generated was different from the tutorial sample. I tried rerunning the deployment with the sample fly.toml contents and not overwriting it, but still ended with the same result.

I’m really stuck everybody. Not sure how to debug the issue. Can someone please help point me in the right direction? Just don’t want to lose the ability to show case my personal projects. Also, if anyone knows - how many apps can we host on in the free tier?

1 Like


That’s not an ideal start :frowning: Essentially Fly has built the image successfully at the top there, however when it tried to run it, it failed. For some reason. You may see more by running fly logs. That sometimes can reveal more info. It’s a tail of the last X lines. So that’s worth a look.

Next, when you say …

I tried to deploy the sample Python Flask app they have on their website

… by “they” do you mean Fly? As in, their sample Python app? Or do you mean the demo app on the Flask site? :thinking:

Only if you meant the one on the Flask site, I’d suggest trying the Fly example Python app. They’ve got some docs for that here:

Of course if you meant the Fly one (from that guide), that’s not great as it suggests it’s now not working. I wonder what’s changed.

Total guess: it may be related to the builder it uses. Only there are two main ways to configure your Fly app. You can use a provided builder (which is basically where the fly launch figures out what type your app is, and picks one, in this case a Python one) or you can have more control over it by using a Dockerfile. That file tells Fly how to build an image for your app. For example a base OS, what files to add and how to run your app. This kind of thing:

# start by pulling the python image
FROM python:3.8-alpine

# copy the requirements file into the image
COPY ./requirements.txt /app/requirements.txt

# switch working directory

# install the dependencies and packages in the requirements file
RUN pip install -r requirements.txt

# copy every content from the local file to the image
COPY . /app

# configure the container to run in an executed manner
ENTRYPOINT [ "python" ]

CMD ["" ]

… which is used in conjunction with a .dockerignore file, which tells it (yep) what files to ignore. As generally you won’t want it sticking all your local files in there. But if you can get going with the provided Python builder, you don’t need to delve into that way. Personally I use a Dockerfile as that’s what I’m more familiar with. And have had more luck with. So that could be worth trying if it’s the builder.

Finally as regards your question about the free tier in the Hobby Plan, you get 3 of the smallest shared-cpu vms with 256mb. So that would be 3 apps for free (assuming 1 vm per app).


Hi @greg ! Thanks for the detailed response! Really appreciate it! Ultimately, using

fly logs

got me heading in the right direction. At first, I got an error in my output that read:

I tried running

pip install gunicorn

but the terminal said it was already installed. Checking my requirements.txt file, gunicorn wasn’t originally in there. So, I ran

pip list

in my directory to see which version of gunicorn I had installed and then explicitly put it in that file as:


But then, I got a module not found error saying I hadn’t installed ‘server’. There’s not a server module that I’m aware of so I checked all my files that might have that word in there and found in the Procfile, it had read:

web: gunicorn server:app

That was automatically generated from an earlier step in the deployment process so I didn’t think to check it. So, I changed that to:

web: gunicorn hellofly:app

and redeployed and I got the app to work!

1 Like


Yep, fly logs is very helpful with stuff like this. Seeing gunicorn: command not found and going from there to see why not found. As you did, and solved it.

1 Like