djangoappengine 上的 UnicodeEncodeError
我已经从 www 下载了 djangoappengine 项目示例 django-guestbook .allbuttonspressed.com 来测试它是如何工作的,但是当我访问 URL localhost:8000 时显示以下错误消息
回溯(最近一次调用最后一次):
文件 “/usr/local/google_appengine/google/appengine/tools/dev_appserver.py”, _HandleRequest 中的第 3245 行 self._Dispatch(调度程序, self.rfile, outfile, env_dict) 文件 “/usr/local/google_appengine/google/appengine/tools/dev_appserver.py”, _Dispatch 中的第 3186 行 base_env_dict=env_dict) 文件“/usr/local/google_appengine/google/appengine/tools/dev_appserver.py”, 第 531 行,调度 base_env_dict=base_env_dict) 文件 “/usr/local/google_appengine/google/appengine/tools/dev_appserver.py”, 2410 号线,调度 self._module_dict) 文件“/usr/local/google_appengine/google/appengine/tools/dev_appserver.py”, 第 2299 行,在 ExecuteCGI 中 os.environ.update(env) 文件“/usr/lib64/python2.6/os.py”,行 486,更新中 self[k] = dict[k] 文件“/usr/lib64/python2.6/os.py”,行 471,在 setitem 中 putenv(key, item) UnicodeEncodeError: 'ascii' 编解码器 无法对字符 u'\xe1' 进行编码 位置 19:序数不在范围内(128)
我现在的 Django 版本是 1.3.0 alpha,但我首先使用版本 1.1.1 进行测试,并发生了相同的错误。命令manage.py runserver运行正常,我没有对项目目录进行任何更改,我只是下载、解压并运行服务器。我还尝试部署该项目(当然是在更改 app.yaml 文件之后),但发生了另一个错误。
有人知道会发生什么吗?我在 7 个小时不间断的时间内尝试了我所知道的一切,但我还是个新手。提前致谢。
I've downloaded the djangoappengine project sample django-guestbook from www.allbuttonspressed.com to test how it works but the following error message is shown when I to access the URL localhost:8000
Traceback (most recent call last):
File
"/usr/local/google_appengine/google/appengine/tools/dev_appserver.py",
line 3245, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict) File
"/usr/local/google_appengine/google/appengine/tools/dev_appserver.py",
line 3186, in _Dispatch
base_env_dict=env_dict) File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py",
line 531, in Dispatch
base_env_dict=base_env_dict) File
"/usr/local/google_appengine/google/appengine/tools/dev_appserver.py",
line 2410, in Dispatch
self._module_dict) File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py",
line 2299, in ExecuteCGI
os.environ.update(env) File "/usr/lib64/python2.6/os.py", line
486, in update
self[k] = dict[k] File "/usr/lib64/python2.6/os.py", line
471, in setitem
putenv(key, item) UnicodeEncodeError: 'ascii' codec
can't encode character u'\xe1' in
position 19: ordinal not in range(128)
My version of Django now is 1.3.0 alpha, but I firstly tested with the version 1.1.1 and the same error occurred. The command manage.py runserver ran ok, and I didn't change nothing inside the project directory, I just downloaded, extracted e ran the server. I also tried to deploy the project (after change the app.yaml file, of course) but another error occurred.
Does someone have an idea of what could be happen? I tried everything I know for 7 uninterrupted hours, but I'm a little newbie yet. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
那么 u'\xe1' 是一个带重音符号的小写 A -->所以
我的猜测是,也许您在配置文件中使用了这个字符,或者您已将项目存储在包含该字符的目录中?然后应用程序引擎尝试在环境变量名称中使用它,并且该名称必须是 ASCII。
Well u'\xe1' is a lowercase A with an accent mark --> á
so my guess is that perhaps you used this character in a configuration file or you've stored the project in a directory that has the character in it? And then app engine is trying to use that in an environment variable name and that has to be ASCII.
问题正是马克所说的。您使用了 unicode 字符,而应仅使用 ASCII。可能在任何配置文件或数据库数据中。检查目录结构并对您编辑的文件进行 grep 来自定义它们。连接到数据库并检查您最近添加的该角色的数据。
不知道该应用程序是如何工作的,但可以肯定的是您已经在某处编写了该应用程序(假设应用程序代码没问题)
The problem is exactly what Marc had said. You've used an unicode character where you should use only ASCII. Probably in any config file or at the database data. Check the directory structure and grep over files that you've edited to customize them. Connect to database and check your recently added data fot that character.
Don't know how that app works, but what is sure is that you've written that á somewhere (assuming the app code is ok)