How do I get Fly to detect my Flask app as one? (and not Django)

fly launch thinks I’m using a Django app, but I’m not.
I have an app.py that only imports flask, and some stdlib stuff. I have a requirements.txt that only contains gunicorn and Flask.
I have two other directories called mock_data and results but neither of them contain .py files.

Any sense of what’s causing the flyctl launch autodetection to do this incorrectly? Any way I can still get all the conveniences of autodetection, but by manually specifying I want to use flask or such?

Okay, tried this out with the sample flask repo, and it still repros, probably a bug with not just my repository?

Version: 0.0.353
Repro steps:

  • git clone https://github.com/fly-apps/python-hellofly-flask
  • fly launch
Scanning source code
Detected a Django app
? App Name (leave blank to use an auto-generated name):
  • fly deploy
    Fails at manage.py not found - which clearly indicates an issue with thinking we’re Django.
1 Like

Sorry for this not-so-great first experience, indeed ou CLI is not properly detecting that this is not a Django app so that’s one thing we need to look into.

In the meantime, I’d suggest you change the Dockerfile to suit your needs. A proper Dockerfile for Flask might make your deployments go faster.

This could be the Dockerfile you need:

FROM python:alpine
RUN pip3 install \\
	boto3 \\
	flask \\
	pytest \\
	requests
COPY . /app
WORKDIR app
ENTRYPOINT \[ "flask" \]
CMD \[ "run", "--host", "0.0.0.0" \]

Taken from fly.io - deploying a Dockerfile to the cloud in seconds | Aaron Kelly’s Blog which has old fly commands but the Dockerfile should still hold up :slight_smile:

If anything happens let me know how I can help you! If possible post your fly.toml too.

Thanks - got it working!
Would also be very cool if this gets fixes, flask is the main framework I use for tiny apps and the promise of a one command, no config-fiddling deploy is very appealing :slight_smile: