Error finding upload folder site storage location site directory maybe it does not exist

У меня есть: Django 1.8.2 джанго-граппелли 2.7.3 django-filebrowser 3.6.4 django-tinymce 2.4.0 В INSTALLED_APPS: INSTALLED_APPS = ( 'grappelli', 'filebrowser', 'django.contrib.admin', В urlpatterns: from filebrowser.sites import site urlpatterns = patterns[ url(r'^admin/filebrowser/...

У меня есть:

  • Django 1.8.2
  • джанго-граппелли 2.7.3
  • django-filebrowser 3.6.4
  • django-tinymce 2.4.0

В INSTALLED_APPS:

INSTALLED_APPS = (
    'grappelli',
    'filebrowser',
    'django.contrib.admin',

В urlpatterns:

from filebrowser.sites import site

urlpatterns = patterns[
   url(r'^admin/filebrowser/', include(site.urls)),
   url(r'^grappelli/', include('grappelli.urls')),
   url(r'^tinymce/', include('tinymce.urls')),
   url(r'^admin/', include(admin.site.urls)),
]

Что, кажется, работает правильно.

Мой MEDIA_ROOT установлен на 'D:\sites\my_site\public_html\media\'.

Я также установил FILEBROWSER_DIRECTORY = 'D:\sites\my_site\public_html\media\' в своих настройках, но по-прежнему получаю ошибку при просмотре http://localhost:8000/admin/filebrowser/browse/:

ImproperlyConfigured at /admin/filebrowser/browse/

Error finding Upload-Folder (site.storage.location + site.directory). Maybe it does not exist?

1 ответ

Лучший ответ

Дело в том, что DIRECTORY установлен в filebrowser.settings по умолчанию на uploads/. Так только что сделал

FILEBROWSER_DIRECTORY = ''
DIRECTORY = ''

В моих настройках, и теперь он работает с использованием MEDIA_ROOT, как я ожидал.

Или можно просто создать каталог uploads внутри MEDIA_ROOT, чтобы он работал.


20

jevgenij
15 Янв 2017 в 18:55

When I try with just these settings,

STATIC_URL = '/static/'

from filebrowser.sites import site
site.directory = "uploads/" 

The link opens and I can browse the uploads folder.

But when I go with the regular settings,

STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_ROOT = BASE_DIR/'static'
MEDIA_ROOT = BASE_DIR/'media'

from filebrowser.sites import site
site.directory = "uploads/" 




This shows the error:

ImproperlyConfigured at /admin/filebrowser/browse/
Error finding Upload-Folder (site.storage.location + site.directory). Maybe it does not exist?

Full traceback:

Environment:


Request Method: GET
Request URL: http://localhost:8000/admin/filebrowser/browse/

Django Version: 3.1.5
Python Version: 3.8.5
Installed Applications:
['grappelli',
 'filebrowser',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'dibbs_spider']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File "C:UsersadminPycharmProjectsspidervenvlibsite-packagesdjangocorehandlersexception.py", line 47, in inner
    response = get_response(request)
  File "C:UsersadminPycharmProjectsspidervenvlibsite-packagesdjangocorehandlersbase.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:UsersadminPycharmProjectsspidervenvlibsite-packagesfilebrowserdecorators.py", line 36, in decorator
    raise ImproperlyConfigured(_("Error finding Upload-Folder (site.storage.location + site.directory). Maybe it does not exist?"))

Exception Type: ImproperlyConfigured at /admin/filebrowser/browse/
Exception Value: Error finding Upload-Folder (site.storage.location + site.directory). Maybe it does not exist?

This error was not on older versions of django.

Содержание

  1. File Upload works but can’t upload folder #3488
  2. Comments
  3. Steps to reproduce
  4. Expected behavior
  5. Actual behavior
  6. Server configuration
  7. filebrowser_safe does not work with Amazon S3 (and presumably other services of the same kind) #530
  8. Comments
  9. Fix: Folder Upload is Not Supported by Your Browser
  10. Pick a good browser, so you won’t have to deal with such errors often
  11. Why is folder upload not supported in the browser?
  12. How do I upload a folder to my browser?
  13. Quick Tip:
  14. Opera
  15. How can I fix folder upload if it’s not supported by the browser?
  16. 1. Update the Browser
  17. 2. Upload Folders With Cloud Storage Apps
  18. How can I upload a folder without ZIP?

File Upload works but can’t upload folder #3488

Steps to reproduce

  1. Drag folder or click upload button in next cloud interface
  2. Will get a «Connection to server lost error»

Expected behavior

Folder and it’s contents should be uploaded.

Actual behavior

Connection to server lost error message. No upload happens

Server configuration

Operating system:
Ubuntu 16.04

Web server:
Apache

Database:

PHP version:

Nextcloud version: (see Nextcloud admin page)
11.0.1.2

Updated from an older Nextcloud/ownCloud or fresh install:
11.0

Where did you install Nextcloud from:

Signing status:

List of activated apps:

App list «` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your Nextcloud installation folder «`

  • activity: 2.4.1
  • calendar: 1.5.0
  • comments: 1.1.0
  • contacts: 1.5.3
  • dav: 1.1.1
  • federatedfilesharing: 1.1.1
  • federation: 1.1.1
  • files: 1.6.1
  • files_pdfviewer: 1.0.1
  • files_sharing: 1.1.1
  • files_texteditor: 2.2
  • files_versions: 1.4.0
  • files_videoplayer: 1.0.0
  • firstrunwizard: 2.0
  • gallery: 16.0.0
  • logreader: 2.0.0
  • lookup_server_connector: 1.0.0
  • nextcloud_announcements: 1.0
  • notifications: 1.0.1
  • password_policy: 1.1.0
  • provisioning_api: 1.1.0
  • richdocuments: 1.1.25
  • serverinfo: 1.1.1
  • sharebymail: 1.0.1
  • survey_client: 0.1.5
  • systemtags: 1.1.3
  • theming: 1.1.1
  • twofactor_backupcodes: 1.0.0
  • updatenotification: 1.1.1
  • workflowengine: 1.1.1
    Disabled:
  • admin_audit
  • bookmarks
  • encryption
  • external
  • files_accesscontrol
  • files_automatedtagging
  • files_external
  • files_retention
  • files_trashbin
  • tasks
  • templateeditor
  • user_external
  • user_ldap
  • user_saml

The content of config/config.php:

Config report », ‘passwordsalt’ => », ‘secret’ => », ‘trusted_domains’ => array ( 0 => ‘nextcloud.kenthinson.com’, 1 => ‘10.0.1.104’, ), ‘datadirectory’ => ‘/var/www/html/data’, ‘overwrite.cli.url’ => ‘http://10.0.1.84’, ‘dbtype’ => ‘mysql’, ‘version’ => ‘11.0.1.2’, ‘dbname’ => ‘nextcloud’, ‘dbhost’ => ‘localhost’, ‘dbport’ => », ‘dbtableprefix’ => ‘oc_’, ‘dbuser’ => ‘nextcloud’, ‘dbpassword’ => », ‘logtimezone’ => ‘UTC’, ‘installed’ => true, ‘maintenance’ => false, ‘updater.secret’ => », ‘theme’ => », ‘loglevel’ => 2, ); «` If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your Nextcloud installation folder

Insert your config.php content here
(Without the database password, passwordsalt and secret)

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM oc_appconfig WHERE appid = ‘user_ldap’;

Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Insert your webserver log here

Insert your Nextcloud log here

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) .

The text was updated successfully, but these errors were encountered:

Источник

filebrowser_safe does not work with Amazon S3 (and presumably other services of the same kind) #530

Trying to open the Media Library fails with the following exception when assets are hosted externally (in this case using django-storages on S3):

This is a major issue when running Mezzanine on a PaaS like Heroku where persistent file system access is limited or completely unavailable.

There is already a fix in the upstream version of django-filwbrowser, although some other minor issues with thumbnail generation still remain.

If the fix cannot easily be incorporated in the existing fork, maybe it’s time to consider abandoning the *_safe-forks and use the newer versions of grappelli and filebrowser instead. Doing so would have the added benefit of

  • Not having to maintain these packages separately and instead focus on the core of Mezzanine,
  • Maybe fix some existing issues (I’m thinking

Apply Mezzanine’s Dynamic inline to Django’s Stacked/Generic inlines #62 )

  • Gaining access to the progress and other improvements made since forking. Grappelli is looking really good now.
  • Keep up the good work!

    The text was updated successfully, but these errors were encountered:

    Until this is resolved, I just thought I’d point out in the thread you linked to, there’s a work-around described:

    «I’ve solved the ImproperlyConfigured: Error finding Upload-Folder. you have to collectstatic to upload to the bucket and check the directory (media/uploads) is declared public!»

    I made the media/uploads in my S3 bucket public, but I’m still getting this error:

    Here you can see that I made both ‘media’ and ‘uploads’ public.

    Here’s what I’ve set up for the S3 storage in my settings.py:

    A solution I’ve been using is to uninstall Filebrowser altogether. Mezzanine appears to simply revert to using Django’s stock FileField and ImageField and so works fine with S3. I recently gave a presentation and put together an example repo on GitHub.

    Would love to hear criticisms or ideas, bug reports about this approach.

    I also tried to make the uploads dir public without success. Will give the workaround by @shurik a shot though, the remaining functionality would still be sufficient for my needs.

    Thanks for sharing Sasha!

    Any news on this issue? I found a workaround to bypass «Error finding Upload-Folder» which is to create an uploads folder on the root of my S3 bucket (not in the media folder). now I can upload files but I got problem on thumbnails generation..

    Good thread recently covering some of the S3 issues and solutions:

    I also have the thumbnails generation problems, I’m trying deploy my mezzanine onto GAE, I think the possible problem is mezzanine do the trick by using «os.makedirs» directly, but not go through your Storage module, so the folder is created on your server but not S3, then cause this problem.

    possible workaround should be use Storage functions instead of os.makedirs

    on GAE it’s worse, GAE doesn’t provide the file operation functions under os .

    As per this discussion, the code that does the thumbnail creation assumes that it has access to filesystem which is not the case with S3 and GAE.

    The thumbnail generation on line 327 (of latest version in GitHub at time of writing) of mezzanine_tags.py assumes access to the local file system:

    In particular this line:

    The solution as described in the post is this:

    This allows ‘saving’ the result of PIL operations to an in memory file, ready to be saved straight to one’s default storage, without the need to store it locally first. Is that something that could be put into Mezzanine?

    @natea yep I think that’s correct.

    So long as it doesn’t regress in any way with local storage backends I’m keen to get this in.

    If anyone wants to get this working and tested with a pull request that’d be awesome.

    I think @littleq0903 is your man. 😉

    On Sun, Apr 14, 2013 at 1:17 AM, Stephen McDonald
    notifications@github.comwrote:

    So long as it doesn’t regress in any way with local storage backends I’m
    keen to get this in.

    If anyone wants to get this working and tested with a pull request that’d
    be awesome.


    Reply to this email directly or view it on GitHubhttps://github.com//issues/530#issuecomment-16346200
    .

    @stephenmcd yeah, I will start working on that after passed the midterm exam, it’s on Tue.

    But I’m not really using Mezzanine so maybe I will need some help or advise from you to avoid doing thing in the wrong way.

    Just wanna get this awesome framework working on PaaS.

    After reading several articles on this issue I can say the following settings works for me on Heroku:

    You have to define StaticS3Backend in a s3utils.py module at root of your mezzanine project.

    Did this make it into any version yet? Just running into the thumbnail issue now. These may be of interest:
    sehmaschine/django-filebrowser#103
    sehmaschine/django-filebrowser#40

    @synasius Does that fix the thumbnail issue also?

    On 3 July 2013 12:51, Dan Gayle notifications@github.com wrote:


    Reply to this email directly or view it on GitHubhttps://github.com//issues/530#issuecomment-20440766
    .

    Nathan Keilar
    Hunted Hive Web Studio

    Innovative Solutions For Real World Problems
    Technical Director and Business Manager

    This email (including any attachments) is confidential and may be
    privileged. If you have received it in error, please notify the sender by
    return email and delete this message from your system. Any unauthorised use
    or dissemination of this message in whole or in part is strictly
    prohibited. Please note that emails are susceptible to change and we will
    not be liable for the improper or incomplete transmission of the
    information contained in this communication nor for any delay in its
    receipt or damage to your system. We do not guarantee that the integrity of
    this communication has been maintained nor that this communication is free
    of viruses, interceptions or interference.

    Источник

    Fix: Folder Upload is Not Supported by Your Browser

    Pick a good browser, so you won’t have to deal with such errors often

    • Uploading data via web browsers is something more than ordinary nowadays.
    • However, some users reported that their browsers couldn’t upload folders.
    • This guide focuses on helping you fix such problems in absolutely no time.

    Many users save files and folders on cloud storage instead of their hard drives. OneDrive, Google Drive, and DropBox are three of the biggest cloud storage providers that give users gigabytes of extra storage space. Users upload their files and folders to their storage space with browsers and cloud storage apps.

    However, not all browsers support folder upload. Google Chrome was the first to support folder uploads, and in 2014 that remained the only browser users could upload folders.

    It took somewhat longer for Mozilla to update Firefox with folder upload support. Thus, older versions of Firefox don’t support folder uploads.

    Why is folder upload not supported in the browser?

    The Folder Upload is not supported by your browser error message pops up when users try uploading folders to Google Drive with some old Firefox versions and browsers that don’t support folder uploads, such as Internet Explorer 11.

    Keep that in mind the next tie you see this error code, just so that you will know what causes it and how to prevent it.

    How do I upload a folder to my browser?

    Usually, the quickest way to do this is by using the classic drag & drop technique, where you click on the desired folder and drag it to your browser window.

    If that doesn’t work for you, you can use all kinds of third-party apps that will allow you to do just that, with upload features.

    Quick Tip:

    Opera is well-known for its trustworthy advanced options, which you may use to toggle and add files and folders to the My Flow integration right in the sidebar. Sync all your devices and manage them easily.

    Moreover, when you send a link, an image, a video, a note, or a file, it is immediately available for download or viewing on your linked devices. It’s as easy as you read about it.

    Opera

    An excellent web browser through which you can easily download and upload files and folders.

    How can I fix folder upload if it’s not supported by the browser?

    1. Update the Browser

    1. Firefox users can update Fox by clicking that browser’s Open menu button.
    2. Click Help and select the About Firefox option.
    3. Firefox will then automatically download the latest update.
    4. Press the Restart to update Firefox button.
    5. Alternatively, users can update any browser by uninstalling and installing the latest version.
      • To do that, open Run by pressing the Windows key + R hotkey.
    6. Input’ appwiz.cpl’ in Run’s text box and click OK to open the Programs and Features uninstaller.
    7. Select the browser to remove, and click the Uninstall option.
    8. Click Yes on any confirmation dialog boxes that pop up.
    9. Restart Windows after removing the browser.
    10. Then download the latest browser version from its website.
    11. Reinstall the browser with its setup wizard.

    Expert tip:

    SPONSORED

    Some PC issues are hard to tackle, especially when it comes to corrupted repositories or missing Windows files. If you are having troubles fixing an error, your system may be partially broken.
    We recommend installing Restoro, a tool that will scan your machine and identify what the fault is.
    Click here to download and start repairing.

    Firefox (and even Chrome) users who still see Folder Upload is not supported by your browser error messages need to update their browsers to the latest versions that support folder uploads.

    Read more about this topic

    2. Upload Folders With Cloud Storage Apps

    Alternatively, users can upload folders with cloud storage apps instead of browsers. For example, Google Drive, DropBox, and OneDrive have apps that sync users’ hard drive storage with cloud storage.

    Those apps usually set up a cloud storage folder that users can drag files and folders in File Explorer to upload. Then, users can download the syncing apps from their cloud storage websites.

    How can I upload a folder without ZIP?

    As we said at the beginning of the article, you can use all kinds of third-party applications that can do the job for you.

    Alternatively, you need to upload each file individually, enumerate the files in the local directory, and then loop over each and upload.

    So, users who need to upload folders to cloud storage can undoubtedly do so by updating Chrome and Firefox browsers. However, users might need to update those browsers if a folder upload error arises.

    There will be, however, situations where you cannot upload documents to websites using Chrome, but now you know what to do.

    For SharePoint, we can’t upload folders or empty files is also a standard error message, but rest assured we are to help you whenever.

    Users utilizing Internet Explorer, and perhaps some other browsers, should switch to Chrome, Firefox, or Edge to upload their folders to cloud storage.

    Источник

        def decorator(request, *args, **kwargs):
    
            if get_path('', site=site) is None:
                # The storage location does not exist, raise an error to prevent
                # eternal redirecting.
                raise ImproperlyConfigured(
                    _("Error finding Upload-Folder (site.storage.location + site.directory)."
                      "Maybe it does not exist?")
                )
            normalized_url = slugify_url(
                request.GET.get('dir', ''),
            )
            get_params = request.GET.copy()
    
            if get_path(normalized_url, site=site) is None:
                site.storage.makedirs(os.path.join(site.directory, normalized_url))
    
            get_params['dir'] = normalized_url
            request.GET = get_params
            return function(request, *args, **kwargs)
     def test_valid(self):
         self.assertTrue(get_path('folder/subfolder', site))

     def test_does_not_exist(self):
         self.assertIsNone(get_path('folder/invalid', site))
     def test_is_absolute(self):
         self.assertIsNone(get_path('/etc/password', site))
         self.assertIsNone(get_path('/folder/subfolder', site))

     def test_starts_with_period(self):
         self.assertIsNone(get_path('..', site))
         self.assertIsNone(get_path('.filter/subfolder', site))
     def test_empty(self):
         self.assertEqual(get_path('', site), '')
    # coding: utf-8
    
    import os
    
    from django.contrib import messages
    from django.core.exceptions import ImproperlyConfigured
    from django.core.urlresolvers import reverse
    from django.http import HttpResponseRedirect
    from django.utils.encoding import smart_text
    from django.utils.translation import ugettext as _
    
    from filebrowser.templatetags.fb_tags import query_helper
    
    
    def get_path(path, site):
        converted_path = smart_text(os.path.join(site.directory, path))
        if not path.startswith('.') and not os.path.isabs(converted_path):
            if site.storage.isdir(converted_path):
                return path
    
    
    def get_file(path, filename, site):
        # Files and directories are valid
        converted_path = smart_text(os.path.join(site.directory, path, filename))
        if not path.startswith('.') and not filename.startswith('.') and not os.path.isabs(converted_path):
            if site.storage.isfile(converted_path) or site.storage.isdir(converted_path):
                return filename
    
    
    def path_exists(site, function):
        "Check if the given path exists."
    
        def decorator(request, *args, **kwargs):
            # TODO: This check should be moved to a better location than a decorator
            if get_path('', site=site) is None:
                # The storage location does not exist, raise an error to prevent eternal redirecting.
                raise ImproperlyConfigured(_("Error finding Upload-Folder (site.storage.location + site.directory). Maybe it does not exist?"))
            if get_path(request.GET.get('dir', ''), site=site) is None:
                msg = _('The requested Folder does not exist.')
                messages.add_message(request, messages.ERROR, msg)
                redirect_url = reverse("filebrowser:fb_browse", current_app=site.name) + query_helper(request.GET, u"", "dir")
                return HttpResponseRedirect(redirect_url)
            return function(request, *args, **kwargs)
        return decorator
    
    
    def file_exists(site, function):
        "Check if the given file exists."
    
        def decorator(request, *args, **kwargs):
            file_path = get_file(request.GET.get('dir', ''), request.GET.get('filename', ''), site=site)
            if file_path is None:
                msg = _('The requested File does not exist.')
                messages.add_message(request, messages.ERROR, msg)
                redirect_url = reverse("filebrowser:fb_browse", current_app=site.name) + query_helper(request.GET, u"", "dir")
                return HttpResponseRedirect(redirect_url)
            return function(request, *args, **kwargs)
        return decorator
    

    Понравилась статья? Поделить с друзьями:
  • Error finding kd exe
  • Error finding installer class matlab что делать
  • Error finding installer class an exception occurred while looking for class что делать
  • Error finding convex hull перевод
  • Error final value in for loop must be numeric or character