We're migrating from webapp2 to the latest version of Django. We want to keep using legacy services like Appengine NDB for now before we move to the latest technologies.
For running the development environment locally I am using devappserver inside a docker environment because devappserver doesn't work with python3 according to Google.
My Google Cloud SDK version inside docker container is: 424.0.0
The server runs, but I keep getting this error whenever I try to access a View that uses some sort of legacy service:
google.appengine.runtime.apiproxy_errors.RPCFailedError: Attempted RPC call without active security ticket
Error log:
The app.yaml (for deployment looks like this):
runtime: python38
instance_class: F2
app_engine_apis: 'True'
entrypoint: bash -c 'python3 manage.py migrate --settings=conf.settings.dev --noinput && gunicorn -b :$PORT main:app'
handlers:
- url: /static
static_dir: static/
- url: /.*
script: auto
secure: always
redirect_http_response_code: 301
builtins:
- deferred: on
env_variables:
DEBUG: 'False'
DB_HOST:
DB_PORT:
DB_NAME:
DB_USER:
DB_PASSWORD:
DJANGO_SETTINGS_MODULE: conf.settings.dev
main.py:
from conf.wsgi import application
from google.appengine.api import wrap_wsgi_app
app = wrap_wsgi_app(application, use_legacy_context_mode=True, use_deferred=False)
The Django app works as expected when deployed to AppEngine Standard Environment. There is no error when running services inside the docker containers locally.
The package that I'm using for app engine bundled legacy service: Legacy Bundled Services
Example view:
from django.views import View
from django.http import JsonResponse
from google.appengine.api import memcache
class UserView(View):
def get(self, request):
memcache.set("Globe", "Jupiter")
return JsonResponse({'hello': memcache.get("Globe")})
I have tried these approaches and failed to resolve the error:
Hi @hassan-arrivy ,
There's already a public issue tracker regarding that issue. You may check it out here.
Regards,
Marc
I have solved the issue by using a patch. However, the issue that you provided is unrelated to this problem.
Do you mind sharing your patch? I will try to take a look and fix.
Here's the patch: https://github.com/NoCommandLine/dev_appserver-python3-windows. It's not my patch however I was able to apply this patch on google cloud SDK version 422 and it worked fine. I'm still curious why DevAppserver doesn't work in a Docker container.