This is related to a bug I raised against app engine while tying to migrate 
from django 1.5 to 1.11.

The issue is I have an app running on app engine using django 1.5.
Recently I was making a number of major updates to the app and decided to 
convert to django 1.11 as part of that update.

Everything seemed to work fine on my local dev_appserver, but when I 
deployed it to app engine, it threw an error similar to this...

ERROR    2019-02-28 19:01:49,710 wsgi.py:263]
Traceback (most recent call last):
  File 
"/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/google_appengine/google/appengine/runtime/wsgi.py",
 
line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File 
"/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/google_appengine/google/appengine/runtime/wsgi.py",
 
line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File 
"/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/google_appengine/google/appengine/runtime/wsgi.py",
 
line 96, in LoadObject
    __import__(cumulative_path)
INFO     2019-02-28 19:01:49,720 module.py:861] default: "GET 
/Common?action=%5B%22logout%22%5D HTTP/1.1" 500 -
  File 
"/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/google_appengine/google/appengine/ext/django/main.py",
 
line 82, in <module>
    management.setup_environ(settings, original_settings_path=settings_path)
AttributeError: 'module' object has no attribute 'setup_environ'


I downloaded the app back to my local development server and built a clean 
python environment using only the exact modules I needed - and then I saw 
the same setup_environ error.
The module indicated has the following code which is throwing the error.

try:
  settings = __import__(settings_path)
  management.setup_environ(settings, original_settings_path=settings_path)
except ImportError:
    pass

I changed the code to 
try:
  settings = __import__(settings_path)
  management.setup_environ(settings, original_settings_path=settings_path)
except AttributeError:
  django.setup()
except ImportError:
    pass

And everything works fine.
My problem is that the changed module appears to be inside the 
google-cloud-sdk and therefore I cannot change it in production.

My app.yaml point to django 1.11

I've searched the net and no one seems to have encountered this problem 
before...there is a lot about setup_environ, but nothing that addresses 
this particular issue.

I even raised a ticket against app engine 
(https://issuetracker.google.com/issues/124539522) but received a reply 
that it was a django problem.

Question is - has anyone else come across this problem in the app engine 
environment - and how did you resolve it?

Thanks!
/Chi







-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/853d28f7-9eab-450f-81bf-f05343939da1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to