Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Upload a File to blobstore or via django-filetransfer?
    primarykey
    data
    text
    <p>Currently, the default Django FileField upload method with the application we host on app engine using Google Cloud SQL returns the following error:</p> <pre><code>OSError [Errno 38] Function not implemented: '/base/data/home/apps/s~app/attachment-1.360717349796013945/media' </code></pre> <p>which is probably due to file writing being restricted in app engine and mkdir not working stated in Django debug mode:</p> <pre><code>/base/python27_runtime/python27_dist/lib/python2.7/os.py in makedirs makedirs(head, mode) except OSError, e: # be happy if someone already created the path if e.errno != errno.EEXIST: raise if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists return mkdir(name, mode) ... </code></pre> <p>Therefore, I attempted to install <a href="http://www.allbuttonspressed.com/projects/django-filetransfers" rel="nofollow">django-filetransfer</a> and the same error persists on Appengine. </p> <p>Django setup:</p> <p><strong>Models</strong></p> <pre><code>class OrderItemAttachmentForm(ModelForm): class Meta: model = OrderItemAttachment exclude = ('item',) def __init__(self, *args, **kwargs): super(OrderItemAttachmentForm, self).__init__(*args, **kwargs) </code></pre> <p><strong>Views</strong></p> <pre><code>def RFO(request): view_url = reverse('app.views.RFO') elif 'saveLine' in request.POST: order_attachment_form = OrderItemAttachmentForm(request.POST,request.FILES) if order_attachment_form.is_valid(): order_attachment = order_attachment_form.save() upload_url, upload_data = prepare_upload(request, view_url) </code></pre> <p><strong>Template</strong></p> <pre><code>{% load filetransfers %} &lt;form id="requestItemForm" name="requestItemSubmit" method="post" enctype="multipart/form-data" action="{{ upload_url }}"&gt;{% csrf_token %}{% render_upload_data upload_data %} &lt;div class="lineAttach"&gt; &lt;label for="id_attachment"&gt;Upload Attachment&lt;/label&gt; {{order_attachment_form.attachment}} &lt;/div&gt; &lt;button type="submit" id="saveLine" name="saveLine" class="btn grey doLoad right" value="Save Line Item"&gt;Save Line Item&lt;/button&gt; </code></pre> <p>I have contemplated using <a href="https://developers.google.com/appengine/docs/python/blobstore/" rel="nofollow">Blobstore python API</a> to store files as a blob or utilize Google Cloud Storage but do not know how to integrate it into Django models. Any help would be appreciated, thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload