I’m trying to get this Extjs4 guide working with Django 1.3. I managed to get it working without Django with just a static json file as the data store.
Then I took the following approach to make it work with a Django app.
- First I created a Django app named
userdbwith a simple User model(only ausernameand anemailfield). - Then I created two views in Django First one(
mysite.com/users/) is aTemplateViewwhich just directs to the index.html template file. The second one(mysite.com/users/getusers) produces a json response exactly like one inusers.jsonfile in the guide. - I have a directory project-static in Django project directory where I put all my static files. So I created
project-static/userdb/extjs/and put all the sdk files there.project-static/userdbalso contains all the JS files I created for the Ext JS app in the guide. - Then I modified the
Users.jsinapp/store/to use the url of thegetusersview. - After that I collected all the static resources to a static folder using
python manage.py collectstaticto be served viamysite.com/static/.
When I visit mysite.com/users/ all the JS files of Ext JS loads fine, But the JS files I wrote for the app doesn’t load because Ext JS does not load them from mysite.com/static/ instead it uses mysite.com/users/. What can I do to resolve this issue?
I realized while reading this blog post that the problem was with the loader not using the /static path of my application. So i needed to do the following to resolve the issue,
in
index.html,Then in
app.jsat the begining of the file,