0
当我做一些后/补丁请求Django的REST的架构基于网络的服务,JSON格式卷曲,我可以看到在一个数据库管理页面上还有变化,但拿一段时间,这一数字到API中反映(GET请求)djangorestframework不能反映资源的变化
预先感谢您。
当我做一些后/补丁请求Django的REST的架构基于网络的服务,JSON格式卷曲,我可以看到在一个数据库管理页面上还有变化,但拿一段时间,这一数字到API中反映(GET请求)djangorestframework不能反映资源的变化
预先感谢您。
另外,还要确保你的中间件是在MIDDLEWARE_CLASSES的最后一件事。 按照从Django的源代码文档:
django.middleware.cache.py(Django的1.5版本)
class UpdateCacheMiddleware(object):
"""
Response-phase cache middleware that updates the cache if the response is
cacheable.
Must be used as part of the two-part update/fetch cache middleware.
UpdateCacheMiddleware must be the first piece of middleware in
MIDDLEWARE_CLASSES so that it'll get called last during the response phase.
"""
# -- snip --
class FetchFromCacheMiddleware(object):
"""
Request-phase cache middleware that fetches a page from the cache.
Must be used as part of the two-part update/fetch cache middleware.
FetchFromCacheMiddleware must be the last piece of middleware in
MIDDLEWARE_CLASSES so that it'll get called last during the request phase.
"""
# -- snip --
class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware):
"""
Cache middleware that provides basic behavior for many simple sites.
Also used as the hook point for the cache decorator, which is generated
using the decorator-from-middleware utility.
"""
# -- snip --
希望我们在这里帮助
没有足够的信息:是什么DBMS你在用吗?哪个OS?你在运行django开发Web服务器吗?生产网络服务器?哪一个?什么是你的中间件配置? –
感谢杰夫的小费。这个问题曾与“django.middleware.cache.UpdateCacheMiddleware”做, – RdB
酷我很高兴你发现它。 –