django-filebrowser and grapelli
     
I have installed Django file browser and added
            django-grappelli
 provides a revamp of the existing django admin look-and-feel. In 
itself, it simply makes your site look better – you’ll need this in case
 a site also needs to provide admin access to the product owner. For 
this case, however, we’re using grappelli as a dependency for 
django-filebrowser.
django-filebrowser does exactly what its name says. In a nutshell, django-filebrowser lets you navigate through and manipulate your media files through your django admin site. This is useful should you eventually need the end-user to be able to control image files without having to dig deep into the server’s internal filesystem.
First, make sure the dependencies are installed. PIL may prove tricky to install, but from there it’s all simple.
  
  
   
Note: the PROJECT_ROOT style makes your settings more portable, so it’s a good habit to start.
Next, we make a symbolic link to the grappelli media folder (in site-packages) from your project media folder.(In the directory defined by MEDIA_ROOT)ln —symbolic /PATH/TO/site_packages/grappelli/media grappelli
Then, make sure your installed apps has this order:
  
  
   
Same goes for your urls,
  
  
   
(In the directory defined by MEDIA_ROOT)
  
  
   
Indicate in additional settings using this as reference:http://code.google.com/p/django-filebrowser/wiki/Settings
  
  
   
Once you’re set up, check it out with the following url:/admin/filebrowser/browse/django-filebrowser does exactly what its name says. In a nutshell, django-filebrowser lets you navigate through and manipulate your media files through your django admin site. This is useful should you eventually need the end-user to be able to control image files without having to dig deep into the server’s internal filesystem.
First, make sure the dependencies are installed. PIL may prove tricky to install, but from there it’s all simple.
- pip install django==1.2
- pip install PIL==1.1.7
- pip install django-grappelli=2.1
- pip install django-filebrowser==3.1
Next, we make a symbolic link to the grappelli media folder (in site-packages) from your project media folder.(In the directory defined by MEDIA_ROOT)ln —symbolic /PATH/TO/site_packages/grappelli/media grappelli
Then, make sure your installed apps has this order:
I have installed Django file browser and added
grappelli and filebrowser to my installed apps. And did every thing said in documention but when I browse http://127.0.0.1:8000/admin/filebrowser/ I got 404 page not found error. What's the problem? I configured my media settings like this:# Media files
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/media/admin/'
FILEBROWSER_DIRECTORY = '/media/'
2 answers
- 
                            
        answered 2014-02-11 17:59
        frnhr
                            
 Just solved the exact same problem, and it's the oldest one in the book: permissions
(facepalm)
 
- make sure your mediadir is chmod-ed to755
- create media/uploadsdir and also chmod it to755
 In settings.py, I don't use theFILEBROWSER_DIRECTORY(I guess thatuploadsis the default)
 I really think that throwing400 Bad Requestis utterly useless and anoying, but oh well...
 
 Just a related note: I don't think there is anything at/admin/filebrowser/, it just gives me a 404. Please correct me it I'm missing something here :)
 
 
- 
                            
        answered 2014-02-11 17:59
        pryma
                            
 The problem is your FILEBROWSER_DIRECTORY setting. It should have absolute path.
 Unfortunately, the error is hidden by the nasty 400 Bad Request, as explained in this ticket.
Django] #21668: Invalid upload_to attribute results in hard-to-debug "Bad Request" 400 error.       
  
12 posts by 1 author
 
 
 
  
 
  
 
   Django        
 12/25/13 
   
    
#21668: Invalid upload_to attribute results in hard-to-debug "Bad Request" 400
error.
------------------------------
 However, django.core.files.storage.
 Finally, django.core.handlers.base.
 All the user sees is "400 Bad Request", no traceback and certainly not the
 original and useful ValueError message.
-- 
Ticket URL: <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 12/25/13 
   
 
Re:
 [Django] #21668: Invalid upload_to FileField attribute results in 
hard-to-debug "Bad Request" 400 error. (was: Invalid upload_to attribute
 results in hard-to-debug "Bad Request" 400 error.)
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 12/25/13 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
 Potentially related #19866
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 3/16/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
Comment:
 There may be some room for improvement here. How/why did you manage to
 attempt to upload a file outside of `MEDIA_ROOT`?
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 3/18/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
 I was attempting to simulate the upload as part of a unit test.  As I
 didn't want the test polluting my actual uploads directory, I was
 attempting to use @override_settings to change the upload path.  The
 resulting error was very hard to diagnose.
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 3/28/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
Comment:
 I think improving the documentation is the best way forward.
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 5/18/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
Comment:
 Working on this in my GSoC project.
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 5/26/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
 Actually, it appears that this raised a more informative error message in
 Django 1.3 (see #22706). We should see if that's possible to restore.
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 6/17/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
Comment:
 Since this appears to be a problem in not getting the correct message, I
 am going to fix this alongwith #22058.
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 6/23/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
 This regressed in 1.6 with this commit:
 https://github.com/django/
 I think we should consider returning a `technical_500_response` in the
 handling of `SuspiciousOperation` as we did before if `settings.DEBUG is
 True` rather than invoking `handler400`.
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 6/24/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------
 Yes, that's the idea. Please add a test. A mention in the release notes
 also wouldn't hurt. I'd also consider adding a `status_code` kwarg to
 `technical_500_response` so we can continue returning a `400` in this
 case.
-- 
Ticket URL: <https://code.djangoproject.
Django <https://code.djangoproject.
 
 
 
   
 
  
 
   Django        
 6/24/14 
   
 
Re: [Django] #21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
#21668: Invalid upload_to FileField attribute results in hard-to-debug "Bad
Request" 400 error.
------------------------------): * status:  assigned => closed
 * resolution:   => fixed
Comment:
 In [changeset:"
 Thanks GDorn and gox21 for report.
 Thanks Tim Graham for idea and review.
 }}}
-- 
Ticket URL: <https://code.djangoproject.
 
 
 
No comments:
Post a Comment