This remains a mystery and I've not been able to solve it but for the way described in the comment. According to the issue list at Github, this was an issue for several users without a clear solution.
Using Django/Grappelli on Google App Engine causes Javascript error on list views in admin
-
14-01-2022 - |
Question
I've deployed my Django app to Google App Engine. It uses grappelli in the admin app for extra awesomeness and although it seems to run ok there's one huge stumbling block which I cannot seem to get rid of. The issue is mentioned here and manifests itself on list views in the admin app. It's impossible to select models from a list and perform any of the predefined actions on them.
On all list views in the admin app I get a Javascript error:
Uncaught TypeError: Object [object Object] has no method 'actions'
which finds it origin in the following snippet of Javascript code:
<script type="text/javascript" charset="utf-8">
(function($) {
$(document).ready(function() {
$("tr input.action-select").actions();
});
})(grp.jQuery);
</script>
Things I've done:
- I deployed grappelli by adding the package to my Django app.
- I've added
STATIC_ROOT
and STATIC_URL entries in mysettings.py
. - I ran
manage.py collecstatic
to collect static files before deployment. All static files are now in the static directory in the app root as referenced insettings.py
. - I've checked the generated page source and it appears that all required Javascript libraries are properly included from their respective static directories. I double checked this by comparing the generated page source with a local running version (which doesn't have this problem) and they are identical.
- I cleared the browser cache.
The problem is most likely caused by my configuration -as the app works flawless on my local machine- but I cannot find anything wrong. Any ideas on how to tackle this?
EDIT: just to be complete, I use Django 1.4
and the grappelli 2.4
running on Google Cloud SQL
Solution
OTHER TIPS
From looking at this ticket: https://github.com/sehmaschine/django-grappelli/issues/214
Your problem might be fixable by changing the order of the staticfiles_finders in settings like so:
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)
Something I didn't notice was that they had to be in that order.
After clearing cache etc, it started working for me.