Thursday, June 28, 2012

Re: django 1.4 + grappelli 2.4: missing css, img files.

Thanks Karl for your reply.
It would appear that ADMIN_MEDIA_PREFIX is Deprecated in django 1.4

root@lablinux:~/django/mysite# python manage.py  runserver 0.0.0.0:8000
/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
Validating models...


I realized that I didn't post my setting.py
Please see my bellowing setting.py:

MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'grappelli',
    'django.contrib.admin',
    'polls',
)


The directory tree is as follows:
root@lablinux:/home/hduser/django/mysite# pwd
/home/hduser/django/mysite
root@lablinux:/home/hduser/django/mysite# ls
admin  grappelli  manage.py  mysite  polls

any idea?
Thanks a lot!!!



On Thursday, June 28, 2012 3:04:25 AM UTC-4, Karl Sutt wrote:
Ali,

Given that your static directory is STATIC_URL = '/static/' and STATIC_ROOT is something like os.path.join(PROJECT_PATH, "static"), add
ADMIN_MEDIA_PREFIX = '/static/grappelli/' (or whatever your static directory is) to your settings.py

That should do the trick. 

Tervitades/Regards
Karl Sutt


On Thu, Jun 28, 2012 at 5:07 AM, bruce <bruceharbin@gmail.com> wrote:
Dear All,

I know this problem is related with grappelli. But it may be a django configure problem. So I am posting my question here.
If it is inappropriate, please let me know. 

I followed the django 1.4's tutorial to setup the 'polls' app and it was successful.
I also followed the grappelli 2.4 quick start guide. 

I followed every step and didn't do anything else. 
The last command is:
python manage.py collectstatic
After this command is executed, two new directories were created(admin and grappelli).

The directory is as follows:
 root@ubuntu:/home/hduser/django/mysite# pwd
/home/hduser/django/mysite
root@ubuntu:/home/hduser/django/mysite# ls
admin  grappelli  manage.py  mysite  mytemplate  polls

Finally, 
I can access the http://127.0.0.1:8000/admin
But, the css,img files are missing. Please see the attached screen shot picture. 

The python manage.py runserver show:
[27/Jun/2012 21:36:19] "GET /admin/css/base.css HTTP/1.1" 404 4468
[27/Jun/2012 21:36:19] "GET /admin/jquery/ui/css/custom-theme/jquery-ui-1.8.custom.css HTTP/1.1" 404 4585
[27/Jun/2012 21:36:19] "GET /admin/css/jquery-ui-grappelli-extensions.css HTTP/1.1" 404 4546
[27/Jun/2012 21:36:19] "GET /admin/jquery/jquery-1.6.2.min.js HTTP/1.1" 404 4510
[27/Jun/2012 21:36:19] "GET /admin/jquery/ui/js/jquery-ui-1.8.15.custom.min.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:19] "GET /admin/js/grappelli/grappelli.js HTTP/1.1" 404 4507
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_collapsible.js HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_timepicker.js HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_collapsible_group.js HTTP/1.1" 404 4564
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_fk.js HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_m2m.js HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_generic.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_autocomplete_fk.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_autocomplete_m2m.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_autocomplete_generic.js HTTP/1.1" 404 4573
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_timepicker.js HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_fk.js HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_m2m.js HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_generic.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_autocomplete_fk.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_autocomplete_m2m.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_autocomplete_generic.js HTTP/1.1" 404 4573



Would you please tell me how to fix it? 
Why 404? 
I know I am supposed to read some web links. Please tell me. 
Thank you!!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/egmDj5ZbW40J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/TCwlyZrBwQgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment