小编hat*_*gic的帖子

AWS Elastic Beanstalk:命令 eb list 不显示环境

我正在使用 Elastic Beanstalk 并创建了 3 个不同的环境。我使用了awsebcli。突然之间,该命令eb list没有显示我的环境,因此我无法部署环境。我得到的错误是ERROR: This branch does not have a default environment. You must either specify an environment by typing "eb status my-env-name" or set a default environment by typing "eb use my-env-name". 我尝试过eb status 'my-env-name',再次出现错误:ERROR: The environment name 'my-env-name' could not be found.简而言之:我无法使用任何eb命令。

bash amazon-web-services aws-cli amazon-elastic-beanstalk

7
推荐指数
2
解决办法
9257
查看次数

Django图像上传不上传日语命名图像

上传日语命名图像时出现的错误是:ascii'编解码器无法对位置 45-48 中的字符进行编码:序号不在范围内(128)

当以英文字符命名时,图像上传完美。另外,奇怪的是我遇到的错误只是在我将其上传到服务器时。日语命名不会上传到部署服务器,但在开发中运行良好。

我的型号:

class Tenant_Post(models.Model):
    user = models.ForeignKey(User,on_delete=models.CASCADE,null=True)
    name = models.CharField(max_length=255,null=True)
    image = models.FileField(upload_to='image/tenant/',null=True)
    posted_on = models.DateTimeField(auto_now_add=True, auto_now=False)
    last_modified_on = models.DateTimeField(auto_now_add=False, 
    auto_now=True)

    def __unicode__(self):
        return self.name
Run Code Online (Sandbox Code Playgroud)

我的看法:

@login_required(login_url='/')
def new(request):
    if request.method == 'POST':
        print request.POST
        form = TenantForm(request.POST or None, request.FILES or None)
        if form.is_valid():
            instance = form.save(commit=False)
            instance.user = request.user
            instance.save()
            print 'success'
            return HttpResponseRedirect(reverse('tenant:all'))
        else:
            print 'fail'
            return render(request,'tenant/new.html',{'form':form,})
    else:
        form = TenantForm()
        return render(request,'tenant/new.html',{'form':form,})
Run Code Online (Sandbox Code Playgroud)

完整追溯在这里:

File "/opt/python/run/venv/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request) …
Run Code Online (Sandbox Code Playgroud)

python django django-models imagefield

3
推荐指数
1
解决办法
740
查看次数