我需要向同一个服务器发出请求,在另一个端口上休息api.
如果不在服务URL中硬编码全名,我怎么能这样做呢?
由于某种原因,我在GAE中获得了西里尔符号的奇怪输入.
在本地环境中一切正常,我得到输入字段中的内容self.request.get('').但是在Appspot上,我得到的是"1mxt1czq0snfzq =="或"0ylqtdgb0yi =",而不是俄语单词.
在.py
!/usr/bin/env python
-*- coding: utf-8 -*-
title = self.request.get('title')
Run Code Online (Sandbox Code Playgroud)
在.html
meta charset="utf-8"
input type="text" name="title" id="title"
Run Code Online (Sandbox Code Playgroud)
我被卡住了.
编辑: 是的,它是Base64,你是对的.但为什么GAE使用它呢?在哪里改变它?为什么本地和Appspot中的行为不同?
我以同样的形式尝试将文件传递给BlobHandler
<form class="form-horizontal" action="{{ upload_url }}" method="POST" enctype="multipart/form-data">
<div class="control-group">
<label class="control-label" for="title">Title</label>
<div class="controls">
<input type="text" name="title" id="title">
</div>
</div>
<div class="control-group">
<label class="control-label" for="file">Load image</label>
<div class="controls">
<input type="file" name="file" id="file" accept='image/*' required="required">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
EDIT2: 是的. https://code.google.com/p/googleappengine/issues/detail?id=2749
看起来像是使用BlobHandler的GAE中的错误.
解决方案:在表单中接受-charset ="utf-8",稍后再尝试.