Search code examples
pythonextjsflasksencha-cmd

Loading error on core ExtJS file


I have following folder structure for my project. I am using ExtJS, Sencha Cmd and Flask to start this project.

Tools/Framework used for UI

Sencha Cmd v6.2.1.29
Ext JS v6.2.1

I have successfully created UI for a sample login app. I have used some hardcoded username and password verification, and it has worked as expected.

However I tried to implement with my webserver which is created using Flask. I modified my application folder structure as following.

project
│   run.py
│
└───static
│   │   ext/ <--- all extjs files here
│   │   app/ <--- my application folder
|   |   index.html
│   │   ...
└───templates
    │   index.html

After executing my flask application, I had a problem. Files required by ExtJS which is app.js, bootstrap.json both are loaded as expected. But it gives error in network saying file not found for ExtJS files. It is expected to ask for file inside static folder, but the request is made in app root directory /ext/build/ while it should have been /static/ext/build/

I just want to append /static/ in every request to ExtJS files. Is there any way of doing this? Or what am I doing wrong?

If I run index.html file located inside static folder, the UI works fine since the path for core ExtJS file matches.

I have followed this link for my app.


Solution

  • Changing entry from app.json file did solve my issue.

    I used relative path from app.json path to point the index.html file that is being used to call the bootstrap.js file. e.g.

    "indexHtmlPath": "../templates/index.html"

    This way every file used by extjs framework is automatically pointed to right path. All the extjs file path was relative to the index.html file.