0

I have a flask app that I'm trying to get running via docker. I'm hitting a problem where one of the modules can't import another, a simplified version of my file structure is this:

app.
+-- README.txt
+-- source_directory
|   +-- source_configs.py
+-- libs
|   +-- api
|   |  +-- api.py
|   +-- header.py
+-- _data
|   +-- jira_extra.py
+-- _site
+-- main.py

The file jira_extra.py has this top import

from /app/libs/api import api

But I'm getting the error

Traceback (most recent call last):
  File "./data/jira_extra.py", line 23
    from /app/libs/api import api

SyntaxError: invalid syntax
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***

Is there a different way to import custom modules from other directories?

davidism
  • 121,510
  • 29
  • 395
  • 339
CEamonn
  • 853
  • 14
  • 37
  • I am not sure but is not that you miss a __init__.py file in the api folder? – BioFrank Jun 25 '18 at 14:18
  • This answer was the correct way to do it as it turns out https://stackoverflow.com/questions/4383571/importing-files-from-different-folder – CEamonn Jun 25 '18 at 14:20
  • That is different then your question, you asked for a module. But good that you have a solution! – BioFrank Jun 25 '18 at 14:26

0 Answers0