Re: Django 1.11: AttributeError: 'module' object has no attribute 'setup_environ'

2019-03-05 Thread Chi Shiek
Also failing in local dev_appserver. It seemed to work for a very short 
time (couple of queries) and then it stopped with the same error. 
Gave up and reverting back to 1.4 (which is what app engine seems to 
recommend - 1.4 or 1.11).

On Friday, 1 March 2019 08:29:42 UTC+11, Chi Shiek wrote:
>
> Didn't work in production...same error...suggestions welcome
>
> On Friday, 1 March 2019 06:41:55 UTC+11, Chi Shiek wrote:
>>
>> 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...
>>
>> ERROR2019-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 
>> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/80cd55a9-4b28-4600-9671-af909a339df8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.11: AttributeError: 'module' object has no attribute 'setup_environ'

2019-02-28 Thread Chi Shiek
Didn't work in production...same error...suggestions welcome

On Friday, 1 March 2019 06:41:55 UTC+11, Chi Shiek wrote:
>
> 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...
>
> ERROR2019-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 
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/8adf927f-30b7-4d91-8b20-33db30142bdd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.11: AttributeError: 'module' object has no attribute 'setup_environ'

2019-02-28 Thread Chi Shiek
Managed to fix it by loading Django as a separate library...
These are the things I had to do...
Used following link to create a libs directory and install django in it 
(via pip - instructions on the page) - also followed the instructions on 
this page for creating a appengine_config.py 

https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27

Removed django from my app.yaml
libraries:
- name: django
  version: "1.11"

commented out these lines from my main.py
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")
#from django.conf import settings

seems I had this in my app.yaml already
env_variables:
  DJANGO_SETTINGS_MODULE: 'core.settings'

That's about it...oh - also removed the changes I made to...

/home/cshiek/Programs/google-cloud-sdk-1.9.83/platform/
google_appengine/google/appengine/ext/django/main.py

Haven't deployed it yet - but at least the dev_appserver is now running 
properly.


On Friday, 1 March 2019 06:41:55 UTC+11, Chi Shiek wrote:
>
> 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...
>
> ERROR2019-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 
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/a51c874b-1119-4e7e-930a-55228462a613%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.11: AttributeError: 'module' object has no attribute 'setup_environ'

2019-02-28 Thread Chi Shiek
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...

ERROR2019-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 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.