I made that change in the bash file and re-ran the export and get this now

USERNAME-macbookpro:Documents USERNAME$ export |grep PYTHON

declare -x PYTHONPATH=
":/Users/USERNAME/Documents/google_appengine:/Users/USERNAME/Documents/google_appengine/lib/django-1.5"

my bash profile is now



# The next line updates PATH for the Google Cloud SDK.                     
     

source '/Users/USERNAME/gcloudsdk/google-cloud-sdk/path.bash.inc'



# The next line enables shell command completion for gcloud.               
     

source '/Users/USERNAME/gcloudsdk/google-cloud-sdk/completion.bash.inc'



export GAE="/Users/USERNAME/Documents/google_appengine"

export PYTHONPATH="$GAE:$GAE/lib/django-1.5"

#export PYTHONPATH="$PYTHONPATH:$GAE:$GAE/lib/django-1.5"                   
    

export PATH=${PATH}:$GAE/lib/django-1.5/django/bin/

running the server, I still get the import django error using command line

On Sunday, August 28, 2016 at 10:59:11 AM UTC-7, Yunkai Zhou wrote:
>
> Hi Mak,
>
> Try modify
>
> export PYTHONPATH="$PYTHONPATH:$GAE:$GAE/lib/django-1.5"
>
> to
>
> export PYTHONPATH="$GAE:$GAE/lib/django-1.5"
>
> I suspect $PYTHONPATH is empty string before that export line, which 
> creates a leading : after export.
>
> On Sunday, August 28, 2016, Mak Ahmad <m...@joobali.com <javascript:>> 
> wrote:
>
>> Hi Adam,
>>
>> How do I remove them from the PYTHONPATH? Here's what I get when I do 
>> emacs ~/.bash_profile
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> # The next line updates PATH for the Google Cloud SDK.                   
>>        
>>
>> source '/Users/USERNAME/gcloudsdk/google-cloud-sdk/path.bash.inc'
>>
>>
>>
>> # The next line enables shell command completion for gcloud.             
>>        
>>
>> source '/Users/USERNAME/gcloudsdk/google-cloud-sdk/completion.bash.inc'
>>
>>
>>
>> export GAE="/Users/USERNAME/Documents/google_appengine"
>>
>> export PYTHONPATH="$PYTHONPATH:$GAE:$GAE/lib/django-1.5"
>>
>> export PATH=${PATH}:$GAE/lib/django-1.5/django/bin/
>>
>>
>>
>> Is this where it needs to be changed I don't even know where the leading 
>> ':' syntax error came from 
>>
>>
>>
>> On Saturday, August 27, 2016 at 12:04:30 PM UTC-7, Adam (Cloud Platform 
>> Support) wrote:
>>>
>>> It's not necessary to add any of the App Engine SDK paths to PYTHONPATH 
>>> for the development server to work. There's also a syntax error (the 
>>> leading ':'). I'd advise just not setting it at all in your shell's config 
>>> file.
>>>
>>> If that doesn't resolve the issue, you can try making a small handler 
>>> from the development server that just prints sys.path and share the 
>>> output of that. It will also help to confirm if *all* external imports 
>>> don't work and not just the Django import.
>>>
>>> On Tuesday, August 23, 2016 at 10:25:38 PM UTC-4, Mak Ahmad wrote:
>>>>
>>>> here it is Adam
>>>>
>>>> USERNAME-macbookpro:Documents USERNAME$ which python
>>>>
>>>> /usr/bin/python 
>>>>
>>>> USERNAME-macbookpro:Documents USERNAME$ python --version 
>>>>
>>>> Python 2.7.10 
>>>>
>>>> USERNAME-macbookpro:Documents USERNAME$ export|grep PYTHON 
>>>>
>>>> declare -x PYTHONPATH=
>>>> ":/Users/USERNAME/Documents/google_appengine:/Users/USERNAME/Documents/google_appengine/lib/django-1.5"
>>>>
>>>>
>>>> hope that helps
>>>>
>>>>
>>>>
>>>> On Tuesday, August 23, 2016 at 3:15:44 PM UTC-7, Adam (Cloud Platform 
>>>> Support) wrote:
>>>>>
>>>>> I'm glad you were able to get it to work with the launcher. If you get 
>>>>> ImportErrors only when starting from the terminal it's possible your 
>>>>> Python 
>>>>> interpreter is misconfigured. You might want to share the output of the 
>>>>> following:
>>>>>
>>>>> Check which Python interpreter you're using
>>>>> $ which python
>>>>>
>>>>> Check your python version
>>>>> $ python --version
>>>>>
>>>>> Check any Python environment variables eg. PYTHON_PATH
>>>>> $ export | grep PYTHON
>>>>>
>>>>>
>>>>> On Monday, August 22, 2016 at 8:09:45 PM UTC-4, Mak Ahmad wrote:
>>>>>>
>>>>>> I tried a few things and also tried
>>>>>>
>>>>>> http://howto.pui.ch/post/39245389801/tutorial-django-on-appengine-using-google-cloud
>>>>>>
>>>>>> with no luck.
>>>>>>
>>>>>> So then I used the "Google App Engine Launcher" and added the 
>>>>>> existing application there and hit start and it worked. For some reason 
>>>>>> starting the application in a terminal using  "dev_appserver.py XXXX" 
>>>>>> doesn't work but with the GUI it does
>>>>>>
>>>>>> On Friday, August 19, 2016 at 3:22:43 PM UTC-7, Adam (Cloud Platform 
>>>>>> Support) wrote:
>>>>>>>
>>>>>>> If you are having issues setting up Django on App Engine I'd advise 
>>>>>>> following the officially documented method, as per 'Running Django 
>>>>>>> on App Engine standard environment 
>>>>>>> <https://cloud.google.com/python/django/appengine>', which uses a 
>>>>>>> pre-configured 'appengine-django-skeleton' project. This method uses 
>>>>>>> 'pip 
>>>>>>> -t' to vendor the latest Django version into the project.
>>>>>>>
>>>>>>> On Wednesday, August 17, 2016 at 12:44:56 PM UTC-4, Mak Ahmad wrote:
>>>>>>>>
>>>>>>>> Sorry there's nothing else I'm doing with the sys path. I just 
>>>>>>>> deleted my working directory and did pip uninstall django so it 
>>>>>>>> uninstalled 
>>>>>>>> it from the Python library. I then recloned the working directory with 
>>>>>>>> all 
>>>>>>>> the sys path code commented and ran the server and still get the same 
>>>>>>>> error.
>>>>>>>>
>>>>>>>> Does Django need to be installed within google python SDK? I know 
>>>>>>>> it's built in but is there an additional step needed? 
>>>>>>>>
>>>>>>>> I am using a Mac by the way 
>>>>>>>>
>>>>>>>> On Tuesday, August 16, 2016 at 3:46:45 PM UTC-7, Adam (Cloud 
>>>>>>>> Platform Support) wrote:
>>>>>>>>>
>>>>>>>>> Are you doing anything else with sys.path anywhere in your code? 
>>>>>>>>> I'm testing again with only the builtin version of django in 
>>>>>>>>> app.yaml, and 
>>>>>>>>> I do not get any ImportErrors.
>>>>>>>>>
>>>>>>>>> You should not need to modify sys.path in any way unless you're 
>>>>>>>>> using an installed version of django somewhere other than the 
>>>>>>>>> application 
>>>>>>>>> root. You should use either the built-in django or vendor your own 
>>>>>>>>> with 
>>>>>>>>> pip, but not both at the same time.
>>>>>>>>>
>>>>>>>>> On Sunday, August 14, 2016 at 2:33:09 PM UTC-4, Mak Ahmad wrote:
>>>>>>>>>>
>>>>>>>>>> Thank you Adam. I should have shared that I already do have 
>>>>>>>>>> django in my app.yaml
>>>>>>>>>>
>>>>>>>>>> application: xxxxxx-xxxx
>>>>>>>>>> version: 1
>>>>>>>>>> runtime: python27
>>>>>>>>>> api_version: 1
>>>>>>>>>> threadsafe: yes
>>>>>>>>>>
>>>>>>>>>> # Handlers match in order, put above the default handler.
>>>>>>>>>> handlers:
>>>>>>>>>> - url: /static
>>>>>>>>>>   static_dir: static
>>>>>>>>>> - url: /.*
>>>>>>>>>>   script: main.application
>>>>>>>>>>
>>>>>>>>>> libraries:
>>>>>>>>>> - name: django
>>>>>>>>>>   version: "1.5"
>>>>>>>>>> - name: jinja2
>>>>>>>>>>   version: "2.6"
>>>>>>>>>> - name: markupsafe
>>>>>>>>>>   version: "0.15"
>>>>>>>>>> - name: ssl
>>>>>>>>>>   version: latest
>>>>>>>>>>
>>>>>>>>>> builtins:
>>>>>>>>>> - django_wsgi: on
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Any thoughts on how I can get the build in django in my sys.path?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Sunday, August 14, 2016 at 10:35:32 AM UTC-7, Adam (Cloud 
>>>>>>>>>> Platform Support) wrote:
>>>>>>>>>>>
>>>>>>>>>>> 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 google-appengine+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-appengine@googlegroups.com.
>> 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/7618dad7-be65-4e96-9872-51b39eb5e800%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-appengine/7618dad7-be65-4e96-9872-51b39eb5e800%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
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/675dd05a-e63c-4b4d-a1d7-8e162d5527b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to