我想爲我的Django 1.8.5(在python3)網站上使用memcached。python3的Django memcached庫
目前我已經嘗試過pylibmc和python-memcached。
pylibmc給了我這個錯誤
libmemcached/get.cc:87 Assertion "ptr->query_id == query_id +1" failed for function "memcached_get_by_key" likely for "Programmer error, the query_id was not incremented."
Number of stack frames obtained: 24
/usr/lib/x86_64-linux-gnu/libmemcached.so.10 : memcached_get_by_key()+0x283
/usr/lib/x86_64-linux-gnu/libmemcached.so.10 : memcached_get()+0x1f
/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/_pylibmc.cpython-34m.so :()+0x61fd
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalFrameEx()+0x3f6a
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalCodeEx()+0x15b
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalFrameEx()+0x4490
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalCodeEx()+0x15b
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalFrameEx()+0x4490
/home/francesco/virtualenvs/TeamCompSite/bin/python() [0x56a7ec]
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyObject_Call()+0x3a
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalFrameEx()+0x1e2f
/home/francesco/virtualenvs/TeamCompSite/bin/python() [0x56a7ec]
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyObject_Call()+0x3a
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalFrameEx()+0x1e2f
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalFrameEx()+0x403d
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_EvalFrameEx()+0x403d
/home/francesco/virtualenvs/TeamCompSite/bin/python() [0x56a7ec]
/home/francesco/virtualenvs/TeamCompSite/bin/python() [0x4e21bd]
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyObject_Call()+0x3a
/home/francesco/virtualenvs/TeamCompSite/bin/python : PyEval_CallObjectWithKeywords()+0x36
/home/francesco/virtualenvs/TeamCompSite/bin/python() [0x5be452]
/lib/x86_64-linux-gnu/libpthread.so.0 :()+0x8182
/lib/x86_64-linux-gnu/libc.so.6 : clone()+0x6d
看起來像一個非常罕見的事情,如找對谷歌我只找到pylibmc: 'Assertion "ptr->query_id == query_id +1" failed for function "memcached_get_by_key"'
不幸的是我不能改變Django是如何處理的memcached lib中。
然後我試了python-memcached
這次我得到了
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f00537e9f28>
Traceback (most recent call last):
File "/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/django/utils/autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
autoreload.raise_last_exception()
File "/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/django/utils/autoreload.py", line 252, in raise_last_exception
six.reraise(*_exception)
File "/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/django/utils/six.py", line 658, in reraise
raise value.with_traceback(tb)
File "/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/django/utils/autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/media/francesco/A6528DA1528D76B9/Programmazione/Python/Spark/team_comp_site/teamcomp/apps.py", line 19, in ready
client.get_stats()
File "/home/francesco/virtualenvs/TeamCompSite/lib/python3.4/site-packages/memcache.py", line 338, in get_stats
stats = line.split(' ', 2)
TypeError: 'str' does not support the buffer interface
看起來像蟒蛇,memcached的只支持python2(我的壞手之前不檢查)
讓我們嘗試python3-memcached的
該網站負荷!
只是爲了告訴我熟悉的錯誤頁面
Exception Value: local variable 'val' referenced before assignment
Exception Location: /home/xxxxx/virtualenvs/xxxx/lib/python3.4/site-packages/memcache.py in _recv_value, line 1026
Python Executable: /home/xxxxx/virtualenvs/xxxxx/bin/python
Python Version: 3.4.3
那麼,什麼是python3(。4)memcached的客戶選擇呢?