Error while creating databricks custom app

Shivaprasad
Contributor

I am trying to create a simple databricks custom app but I am getting Error: Could not import 'app'. error.

app.yaml file

env:
 - name: FLASK_APP
   value: '/Workspace/Users/sam@xxx.com/databricks_apps/hello-world_2025_11_13-16_19/Gaap_commentry/app'

command: [
  "flask",
  "app.py",
  "run"
]
Looks like it's not able to locate the app. How I can fix the import error
 
 
 

 

Raman_Unifeye
Honored Contributor III

Seems like you are combining a file path for FLASK_APP with running a file using command. When FLASK_APP is set to a full path, Flask expects that path to point to a Python file (e.g., app.py) or package that contains the application instance.

​Correct FLASK_APP and command

​Adjust your app.yaml file to only point FLASK_APP to the directory containing your main Python file (app.py), and then set the command to run the file directly


RG #Driving Business Outcomes with Data Intelligence

Shivaprasad
Contributor

Thanks, I have modified the yaml file but still getting Error: Could not import 'app'   error

env:
  - name: FLASK_APP
    value: '/Workspace/Users/xxx@zzz.com/databricks_apps/hello-world_2025_11_13-16_19/Gaap_commentry'

command: [
  "flask",
  "--app",
  "app.py",
  "run"
  ]