我正在尝试在 appengine-django 中上传文档。使用纯 django 代码 [ 使用 python manage.py runsever ] 成功上传文档。但是当我试图用 appengine 项目运行 django 时,它给了我错误,
[Errno 30] Read-only file system: u'/home/nishant/workspace1/problemdemo/uploaded_files/1372313114_43_nishant26062013.zip'
导致此错误是因为Developers have read-only access to the filesystem on App Engine.
是否有另一种方法可以将文档上传到谷歌云 sql ?
这是我的代码,
模型.py
from django.db import models
import time
# Create your models here.
def get_upload_file_name(instance,filename):
return "uploaded_files/%s_%s" % (str(time.time()).replace('.','_'),filename)
class Candidate(models.Model):
title=models.CharField(max_length=20)
resume=models.FileField(upload_to=get_upload_file_name)
def __unicode__(self):
return self.title
表格.py
from django import forms
from actualproblem.models import Candidate
class TestForm(forms.ModelForm):
class Meta:
model=Candidate
fields=('title','resume',)
视图.py
# Create your views here.
from django.shortcuts import render
from actualproblem.forms import TestForm
def sampletest(request):
if request.method=='POST':
form = TestForm(request.POST,request.FILES)
if form.is_valid():
form.save()
else:
form=TestForm()
return render(request,'profile.html',{'form':form})
如何将文档上传到谷歌云 sql?