You're getting the ImportError because django is not in your sys.path.

If you want to use one of the built-in django versions 
<https://cloud.google.com/appengine/docs/python/tools/built-in-libraries-27> 
from the App Engine SDK, simply add this to your app.yaml (it's not 
necessary to install the Django library separately):

libraries:
- name: django
  version: "1.4"

If you want to include your own django version with your app (eg. to use a 
recent version > 1.5), don't add the above line and instead install the 
library directly into your project's root directory:

$ cd myapp/
$ pip install django -t .

If you want to install to a subfolder 
<https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27#installing_a_library>
 
like 'lib', first add these lines to your app, preferably in 
appengine_config.py in the root of your project:

from google.appengine.ext import vendor

# Add any libraries installed in the "lib" folder.
vendor.add('lib')

Then install the library:

$ cd myapp/
$ pip install django -t lib/

By default dev_appserver.py excludes local site-packages and it's best to 
not try and override this, since your app will only work locally and not 
when deployed.

On Saturday, August 13, 2016 at 12:33:25 PM UTC-4, Mak Ahmad wrote:
>
> Forgot to mention, I get that django wsgi error when trying to access 
> http://localhost:8080/
>
> On Saturday, August 13, 2016 at 9:31:47 AM UTC-7, Mak Ahmad wrote:
>>
>> Hi I'm getting the following error and cannot find anything in the forums 
>> that has helped me with AppEngine:
>>
>> ImportError: No module named django.core.handlers.wsgi 
>>
>> Here's my code
>> import os
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'app.settings'
>>
>> #import sys
>> #sys.path.append('lib')
>> #sys.path.append('//Library/Python/2.7/site-packages/django')
>> import django.core.handlers.wsgi
>>
>> from requests_toolbelt.adapters import appengine
>> appengine.monkeypatch()
>>
>> application = django.core.handlers.wsgi.WSGIHandler()
>>
>>
>> I tried manually adding django to the library but that didn't work 
>> either. I also tried going to the google_appengine django 1.5 library 
>> folder and doing a python setup.py but that didn't work either.
>>
>> Any thoughs? I know Django is builtin to appengine just don't see where 
>> my system path issue is. 
>>
>> I can do the following with no error
>>
>> Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
>>
>> [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
>>
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>> >>> import django
>>
>> >>> import django.core.handlers.wsgi
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/22887b6f-27e2-4bc9-bf08-6cfd6214d719%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine] I... Mak Ahmad
    • [google-appengi... Mak Ahmad
      • [google-app... 'Adam (Cloud Platform Support)' via Google App Engine
        • [google... Mak Ahmad
          • [go... 'Adam (Cloud Platform Support)' via Google App Engine
            • ... Mak Ahmad
              • ... 'Adam (Cloud Platform Support)' via Google App Engine
                • ... Mak Ahmad
                • ... 'Adam (Cloud Platform Support)' via Google App Engine
                • ... Mak Ahmad
                • ... 'Adam (Cloud Platform Support)' via Google App Engine
                • ... Mak Ahmad
                • ... Yunkai Zhou

Reply via email to