FitTrackee icon indicating copy to clipboard operation
FitTrackee copied to clipboard

Failed to find Flask application

Open lukasheinz92 opened this issue 1 year ago • 6 comments

Hello,

when I try to run my containers, I get following error in the fittrackee container:

Usage: flask run [OPTIONS]
Try 'flask run --help' for help.
Error: Failed to find Flask application or factory in module '__main__'. Use '__main__:name' to specify one.

lukasheinz92 avatar May 11 '24 09:05 lukasheinz92

Hi,

what is the value of the environment variable FLASK_APP in the .env file?

SamR1 avatar May 11 '24 14:05 SamR1

Hi, it is FLASK_APP=fittrackee/__main__.py.

lukasheinz92 avatar May 13 '24 07:05 lukasheinz92

Hi,

Thanks for your answer. The value is correct.

Have any changes been made to the configuration? The container should start up without having to make any changes to the .env file after copying it from .env.docker.

SamR1 avatar May 15 '24 12:05 SamR1

Hi,

No, I haven't changed any configuration in the env file, I only changed the volumes and ports in the docker-compose. Regarding the .env.docker file, I haven't copied it to .env - the docker-compose contains this:

env_file:
  - .env.docker

lukasheinz92 avatar May 15 '24 20:05 lukasheinz92

Hi,

can you try with .env instead (see documentation)?
Some shell scripts source the .env file.

SamR1 avatar May 17 '24 05:05 SamR1

Hi,

I followed the documentation:

  • git clone https://github.com/SamR1/FitTrackee.git
  • cd FitTrackee
  • cp .env.docker .env
  • make docker-build
  • I updated the docker-compose-dev.yml (the volumes and ports)
  • make docker-init

But I got this error: OCI runtime exec failed: exec failed: unable to start container process: exec: "docker/init-database.sh": stat docker/init-database.sh: no such file or directory: unknown make: *** [Makefile:64: docker-init-db] Error 126 but I can see the init-database.sh file in the docker subdirectory. In the logs in fittrackee container I can still see the error: Error: Failed to find Flask application or factory in module '__main__'. Use '__main__:name' to specify one.

I am trying to run it on Raspberry Pi and I also can see the terminal ...platform (linux/amd64) does not match the detected host platform (linux/arm64/v8)... - not sure if this can be a problem.

lukasheinz92 avatar May 19 '24 08:05 lukasheinz92

Hi,

does adding the platform in docker-compose-dev.yml solve the issue?

SamR1 avatar May 20 '24 06:05 SamR1

Hi,

I tried this:

  fittrackee:
    container_name: fittrackee
    platform: "linux/arm64"
    build:
      context: "."
      platforms:
        - "linux/arm64"

... but the same issue.

lukasheinz92 avatar May 28 '24 17:05 lukasheinz92

Hi,

Is it the same error? Python image should exist for linux/arm64/v8.

SamR1 avatar May 29 '24 18:05 SamR1

Hi,

yes, it was the same error.

lukasheinz92 avatar Jun 09 '24 06:06 lukasheinz92

Hi,

3.10 tag corresponds to 3.10.14-bookworm . Perhaps another python image may work. Or additional modifications may also be required in the Docker file.

I'm sorry I can't find an immediate solution, and I don't have a Raspberry Pi available with Raspbian to investigate the issue :/. I'll try to find one.

SamR1 avatar Jun 09 '24 13:06 SamR1

I was not able to fix the issue.

lukasheinz92 avatar Jun 19 '24 17:06 lukasheinz92