Flask assets searching in the wrong directory

1.2k views Asked by At

I am trying to get Flask-Assets to load my assets.

My css is here: /home/myname/projects/py/myapp/myapp/static/css/lib/somecsslib.css

It is by default looking in the wrong directory. I get this:

No such file or directory: '/home/myname/projects/py/myapp/static/css/lib/somecsslib.css'

I am initializing it normally;

assets = Environment(app)

I tried setting the load_path:

assets.load_path = '/home/myname/projects/py/myapp/myapp/static/'

When I do that I get the following error:

BundleError: 'css/lib/somecsslib.css' not found in load path: /home/myname/projects/py/myapp/myapp/static/

EDIT

I just found out that load_path is a list.
I tried this instead: assets.load_path.append('/home/myname/projects/py/myapp/myapp/static/')
I got this as a result:
BuildError: [Errno 2] No such file or directory: '/css/lib/somecsslib.css'

1

There are 1 answers

1
Johnston On

Flask was incorrectly identifying the location of my static folder. That was the issue. To solve it I told Flask where my static folder sits.