django_pylibmc在Django 1.7和python 3.4下抱怨 [英] django_pylibmc complains under Django 1.7 and python 3.4

查看:184
本文介绍了django_pylibmc在Django 1.7和python 3.4下抱怨的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的环境: 的Django 1.7 Python 3.2

My environment: Django 1.7 Python 3.2

作为免责声明,我是Django和Python的新手.

As a disclaimer, I'm new to Django and Python.

我正在阅读 doc 以便将Memcachier与Django结合使用.

I'm going through this doc in order to use Memcachier with Django.

安装过程没有给我任何错误,但是当我使用./manage.py tests启动测试时,出现以下错误:

The installion process didn't give me any errors, but when I fire up my tests with ./manage.py tests I get the following error:

   return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1467, in exec_module
  File "<frozen importlib._bootstrap>", line 1572, in get_code
  File "<frozen importlib._bootstrap>", line 1532, in source_to_code
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File ".../lib/python3.4/site-packages/django_pylibmc/memcached.py", line 92
    except MemcachedError, e:

SyntaxError: invalid syntax

我正在查看python 3.x 文档中的错误似乎该文件的第92行确实是无效的语法,但我不确定.

I'm looking at the python 3.x docs for errors and it seems that line 92 of that file is indeed not valid syntax, but I'm not sure.

有人可以提出可能的解决方案吗?

Can anyone suggest a possible fix?

推荐答案

我知道您正在关注建议使用django-pylibmc的Heroku文档,但是Django在django.core.cache.backends.memcached.PyLibMCCache的基础上支持Pylibmc.由于这些只是pylibmc C库的python包装器,因此django-pylibmc确实没有理由.

I know you are following the Heroku docs which suggest using django-pylibmc, but Django supports Pylibmc out of the box with django.core.cache.backends.memcached.PyLibMCCache. Since these are just python wrappers over the pylibmc C libraries there should be really no reason to go with django-pylibmc.

如果您查看自述文件( https://github.com/jbalogh/django- pylibmc#requirements )用于django-pylibmc,它声明它是使用Python 2.7编写和测试的,因此在这里使用Python 3也是有问题的.

Also if you look at the README (https://github.com/jbalogh/django-pylibmc#requirements) for django-pylibmc it states that it was written and tested with Python 2.7, so the use of Python 3 is also problematic here.

我赞扬您将Python 3与Django配合使用的努力,但请确保您的所有第三方应用程序都兼容,我强烈建议您从Django文档中阅读以下内容:

I applaud your efforts for using Python 3 with Django, but please make sure that all your third party apps are compatible and I highly recommend reading this from the Django docs: https://docs.djangoproject.com/en/1.7/topics/python3/

这篇关于django_pylibmc在Django 1.7和python 3.4下抱怨的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆