Home > Mobile >  Django AssertionError No api proxy found for service "memcache"
Django AssertionError No api proxy found for service "memcache"

Time:02-17

I'm running a Django app on GAE and I want to use memcache in my views.py to store some data for caching. I have not setup anything for caching in my settings.py and immediately use from google.appengine.api import memcache inside of views.py and pulls/insert data using the .add() and .get() method. This however, results in an

AssertionError at / : No api proxy found for service "memcache"

What am i missing here? Should I be setting up something inside of settings.py? From my understanding memcache is a built-in feature of GAE and I figured it worked the same way as an API key where we would not need to specify them inside of the settings.py

Plus the documentation also does not provide any information on proxy setup or whatsoever.

CodePudding user response:

Moving details from comments section to full answer

  1. Python 3 does not have the bundled services enabled by default. You have to follow the guidelines documented here to enable them.

  2. Regarding question by OP (in comments section) - your Django App will have a 'main' file that is launched when you invoke your app i.e. the file that has the app object or where you import the application module(a common name for this file is main.py). It is in that file that you add the code because it will serve as a wrapper to the application module

  • Related