cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

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
 
 
 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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"
  ]

View solution in original post

2 REPLIES 2

Raman_Unifeye
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

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"
  ]

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now