How to use local filesystem as storage backend in ORA2?

1249 views
Skip to first unread message

guoshuai

unread,
Mar 24, 2015, 2:54:41 AM3/24/15
to edx-...@googlegroups.com
Hi, everyone:
    We want to upload openassessment student files (images) to a local filesystem in ORA2. And I have seen that there is PR about it ( Allow file upload backends other than S3 https://github.com/edx/edx-ora2/pull/640). Recently this PR has been merge into the master branch. 
    However, I do not know how to configure to use local filesystem. 
    I have updated ora2 to the latest version and checkout master branch, the student files are still uploaded to S3.
    Could you help me solve this or is there some doc I can follow step by step?
    Thanks very much!!

guoshuai    

John Eskew

unread,
Mar 24, 2015, 9:37:52 AM3/24/15
to edx-...@googlegroups.com
There's no documentation that I've seen - unless the original PR submitters have some internal documentation.

Our edX documentation team has this task on their queue: https://openedx.atlassian.net/browse/DOC-1776

Until that task is complete, you'll likely need to figure out how to configure it by examining the listed PR and its changes.

--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/6456e747-616f-4dc9-bbca-b11413014745%40googlegroups.com.

guoshuai

unread,
Mar 25, 2015, 9:25:11 AM3/25/15
to edx-...@googlegroups.com
Hi, John:
    Thanks for your rely. I understand what you mean.
    Now I configure it like this:
            "
                ORA2_FILEUPLOAD_BACKEND="filesystem"
                ORA2_FILEUPLOAD_ROOT='/tmp'
                ORA2_FILEUPLOAD_CACHE_NAME='default'
                FILE_UPLOAD_STORAGE_BUCKET_NAME="testbucket"
            "
   Then, when I flash the open assessment page , I catch an exception like this:
            "
                Traceback (most recent call last):                                                                                                       
                  File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/module_render.py", line 920, in _invoke_xblock_handler
                    resp = instance.handle(handler, req, suffix)
                  File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/mixins.py", line 85, in handle
                    return self.runtime.handle(self, handler_name, request, suffix)
                  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1164, in handle
                    return super(MetricsMixin, self).handle(block, handler_name, request, suffix=suffix)
                  File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/runtime.py", line 1025, in handle
                    results = handler(request, suffix)
                  File "/edx/app/edxapp/venvs/edxapp/src/edx-ora2/openassessment/xblock/submission_mixin.py", line 332, in render_submission
                    path, context = self.submission_path_and_context()
                  File "/edx/app/edxapp/venvs/edxapp/src/edx-ora2/openassessment/xblock/submission_mixin.py", line 363, in submission_path_and_context
                    context['file_url'] = self._get_download_url()
                  File "/edx/app/edxapp/venvs/edxapp/src/edx-ora2/openassessment/xblock/submission_mixin.py", line 238, in _get_download_url
                    return file_upload_api.get_download_url(self._get_student_item_key())
                  File "/edx/app/edxapp/venvs/edxapp/src/edx-ora2/openassessment/fileupload/api.py", line 20, in get_download_url
                    return backends.get_backend().get_download_url(key)
                  File "/edx/app/edxapp/venvs/edxapp/src/edx-ora2/openassessment/fileupload/backends/filesystem.py", line 42, in get_download_url
                    return self._get_url(key)
                  File "/edx/app/edxapp/venvs/edxapp/src/edx-ora2/openassessment/fileupload/backends/filesystem.py", line 47, in _get_url
                    url = reverse("openassessment-filesystem-storage", kwargs={'key': key_name})
                  File "/edx/app/edxapp/venvs/edxapp/src/django-wiki/wiki/models/__init__.py", line 79, in reverse
                    url = original_django_reverse(*args, **kwargs)
                  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 502, in reverse
                    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
                  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 422, in _reverse_with_prefix
                    "arguments '%s' not found." % (lookup_view_s, args, kwargs))
                NoReverseMatch: Reverse for 'openassessment-filesystem-storage' with arguments '()' and keyword arguments '{'key': 'submissions_attachmen
                ts/a0059f9a3af9667295c42864d73a9061/buaa/b2/2015_T1/i4x://buaa/b2/openassessment/016e56c7e9cd4479ad6fdbf72f5758ab'}' not found.
                2015-03-25 09:04:55,104 ERROR 11144 [root] exceptions.py:9 - Uncaught exception from <class 'django.core.handlers.wsgi.WSGIHandler'>
          "

        I don't know how to fix it. Can you help me? Thanks a lot.
   
guoshuai
  

在 2015年3月24日星期二 UTC+8下午9:37:52,John Eskew写道:

John Eskew

unread,
Mar 25, 2015, 12:17:47 PM3/25/15
to edx-...@googlegroups.com
Looks like the Django URL reversing failed. That URL is contained in this file:

edx-ora2/openassessment/fileupload/urls.py

Is it present in your release?


guoshuai

unread,
Mar 26, 2015, 1:21:08 AM3/26/15
to edx-...@googlegroups.com
hi, John:
    Thanks a lot for your reply.
    
    In the file "edx-ora2/urls.py" contains the URL you mentioned. It looks like this:

    “

              urlpatterns = patterns(

              '',

             # Django built-in

             url(r'^admin/', include(admin.site.urls)),

 

             # Provided by XBlock

             url(r'^/?', include(workbench.urls)),

 

             # edx-ora2 apps

             url(r'^peer/evaluations/', include(openassessment.assessment.urls)),

 

             # JavaScript i18n

             (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', JS_INFO_DICT),

 

             # File upload to local filesystem

             url(r'^openassessment/storage', include(openassessment.fileupload.urls))

          )

         

        However, the exception still occurred. 
        
        Need I add the URL in other urls.py files? if so, which one? and how to add it?
  
        Looking forward to your relay. Thanks very much!

guoshuai

在 2015年3月26日星期四 UTC+8上午12:17:47,John Eskew写道:

John Eskew

unread,
Mar 26, 2015, 8:42:46 AM3/26/15
to edx-...@googlegroups.com, regis...@openfun.fr
I've never actually used the feature myself, so I'm not quite sure why you're seeing the error. However, I'm copying the original developer of this functionality on this email - perhaps he can assist?

guoshuai

unread,
Mar 26, 2015, 8:43:04 AM3/26/15
to edx-...@googlegroups.com
hi, John:
    I also find that when I run the OpenEdx site, the urls.py in edx-ora2 seems NOT to executed. ( I inserted a print line in edx-ora2/urls.py, and did not find the certain information at console log).
    How should I configure in edx-platform to let the urls in edx-ora2 be found?

    Thanks!

guoshuai
在 2015年3月26日星期四 UTC+8下午1:21:08,guoshuai写道:

guoshuai

unread,
Mar 26, 2015, 9:57:19 AM3/26/15
to edx-...@googlegroups.com, regis...@openfun.fr
Hi, John:
    With the help of  Regisb, I fix it finally.
    "  Add the  certain URL into lms/urls.py, and import openassessment.fileupload.urls into lms/urls.py"
    after add the above two lines, it works well. and the images are uploaded to local filesystem. 
    Thanks!
guoshuai

在 2015年3月26日星期四 UTC+8下午8:42:46,John Eskew写道:
Message has been deleted

jay.q...@gmail.com

unread,
May 3, 2016, 6:54:28 AM5/3/16
to General Open edX discussion
You need to config below settings:

in lms/common.py:

ORA2_FILEUPLOAD_BACKEND = "filesystem"
# your prefered cache system
ORA2_FILEUPLOAD_CACHE_NAME="default"
#where you want to upload ora2 files
ORA2_FILEUPLOAD_ROOT = os.path.join(MEDIA_ROOT, 'ora-upload/')

In lms/urls.py:

from openassessment.fileupload.urls import urlpatterns as oraurlpatterns
urlpatterns+= oraurlpatterns Thanks & Regards, Jay Modi, Python Django developer, Quixom Technolgies

Christos Bellos

unread,
Oct 3, 2016, 7:08:36 AM10/3/16
to General Open edX discussion
I am trying to use the ORA2 and upload files to our server. I think that we have performed all the recommended steps, but with no success.

Is it possible to post the steps, sth like a tutorial for dummies? That would be really really appreciated, because I am following several threads and performed several recommendations from users with no success.
For example, I have followed these steps: https://github.com/edx/edx-documentation/blob/master/en_us/install_operations/source/configuration/ora2/ora2_uploads.rst#id6
and these: https://groups.google.com/forum/#!msg/edx-code/L8Ga4RSsa50/t5wM2h-XSNsJ

Nate Aune

unread,
Oct 3, 2016, 8:12:50 PM10/3/16
to General Open edX discussion, George Song
Hi Christos,

I encountered the same problem and reported the issue here (https://openedx.atlassian.net/browse/DEVSTACK-26) but as of yet there has been no response from the edX team.

It appears that the ORA2 doesn't honor the global setting DEFAULT_FILE_STORAGE": "django.core.files.storage.FileSystemStorage"
But defaults to use Amazon S3, irregardless of what is set for DEFAULT_FILE_STORAGE.

Nate

Christos Bellos

unread,
Oct 4, 2016, 12:14:07 PM10/4/16
to General Open edX discussion, gs...@edx.org
Thanks Nate for your reply. I was worrying that I am the only left that did not solve this problem... ;-)
Hopefully we'll have some help on this.

Christos Bellos

unread,
Oct 4, 2016, 12:24:43 PM10/4/16
to General Open edX discussion, gs...@edx.org
Also, I just used the 1 hour demo of the Bitnami OpenEdX for AWS and there is the same problem...

It says:
"Unable to upload file"
"Error on retrieving upload URL"

Do you have the same error message?

Nate Aune

unread,
Oct 7, 2016, 8:43:37 PM10/7/16
to edx-...@googlegroups.com, George Song
yeah, and if you look at your LMS log file, it should have an error
that looks like this:
NoAuthHandlerFound: No handler was ready to authenticate. 1 handlers
were checked. ['HmacAuthV1Handler'] Check your credentials}}
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "General Open edX discussion" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/edx-code/e4810158-69fc-4305-bec9-1eb651d3feb3%40googlegroups.com.



--


Website: http://www.appsembler.com
Blog: http://www.appsembler.com/blog
Twitter: http://twitter.com/natea
LinkedIn: http://linkedin.com/in/natea
Phone: +1 (617) 702-4331

Amal MAHIOU

unread,
Mar 6, 2017, 5:31:11 AM3/6/17
to General Open edX discussion, gs...@edx.org
Hi,
I got the same error, i try to upload files with ORA2 in my local system and i get this error :
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/src/ora2/openassessment/xblock/submission_mixin.py", line 245, in upload_url
    url = file_upload_api.get_upload_url(key, content_type)
  File "/edx/app/edxapp/venvs/edxapp/src/ora2/openassessment/fileupload/api.py", line 14, in get_upload_url
    return backends.get_backend().get_upload_url(key, content_type)
  File "/edx/app/edxapp/venvs/edxapp/src/ora2/openassessment/fileupload/backends/s3.py", line 29, in get_upload_url
    raise FileUploadInternalError(ex)
FileUploadInternalError: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials
I hope some body has a solution.

Amos Wachanga

unread,
Jun 14, 2019, 8:47:33 PM6/14/19
to General Open edX discussion
Was this ever resolved?
Reply all
Reply to author
Forward
0 new messages