[Fixed]-Django + Pydev/Eclipse + Google App Engine – possible?

9👍

I haven’t personally set it up but i did see this tutorial on how to do it:

http://code.google.com/appengine/articles/eclipse.html

👤Sam

5👍

Pydev 1.4.6 (still only available in the nightly builds) has some special support to easy in the configuration. See: http://pydev.blogspot.com/2009/05/testing-on-pydev-146-google-app-engine.html

3👍

This tutorial shows how to configure Aptana (with PyDev installed) to be your coding and debugging platform for AppEngine. Similarly you can add Django libraries to Aptana too.

http://www.alishabdar.com/2009/05/06/develop-google-appengine-with-aptana-studio/

3👍

This question hasn’t been replied to for some time and things have changed, so I thought I would provide and update.

PyDev now includes a Google App Engine configuration out of the box and you can debug and run GAE projects out of the box, this includes Django.

Just install GAE and the latest Eclipse/PyDev on your machine then create a GAE project and point PyDev at your versions of Python and Google App Engine.

👤Jules

2👍

I originally linked to this tutorial. Pydev now has Django support so this is probably less relevant. It may still be useful for figuring out how to make them all work together though. You could also try looking at this blog post.

2👍

appengine 1.31
Django 1.1
pydev 1.5.4
OS Ubuntu 9.10


eclipse .pydevproject file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>
<pydev_project>
<pydev_variables_property name="org.python.pydev.PROJECT_VARIABLE_SUBSTITUTION">
<key>GOOGLE_APP_ENGINE</key>
<value>/home/elvis/google_appengine</value>
</pydev_variables_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/pythonleggo</path>
</pydev_pathproperty>
<pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH">
<path>${GOOGLE_APP_ENGINE}</path>
<path>${GOOGLE_APP_ENGINE}/lib/webob</path>
<path>${GOOGLE_APP_ENGINE}/lib/yaml/lib</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>

Files:

eclipse project folder
– app.yaml
– index.yaml
init.py
– main.py
– manage.py
– .project
– .pydevproject
– settings.py (unable to load)
– urls.py


main.py:

from google.appengine.dist import use_library  
use_library('django', '1.1')  

from django.conf import settings

settings.configure(
DEBUG=True,
TEMPLATE_DEBUG=True,
ROOT_URLCONF = 'urls',
PROJECT_NAME = 'pythonleggo',
SETTINGS_MODULE = '.settings',
ADMINS = ('elvis', 'elvis@gmail.com'),
LANGUAGE_CODE = 'en-us',
SITE_ID = 1,
USE_I18N = True,
MEDIA_ROOT = '',
MEDIA_URL = '',
ADMIN_MEDIA_PREFIX = '/media/',
SECRET_KEY = 'shhh',
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source'),
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware'),

TEMPLATE_DIRS=('/home/jmurphy/workspace/pythonleggo/templates'),
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites')
)

#os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
from google.appengine.ext.webapp import util

def main():
    # Run Django via WSGI.
    application = django.core.handlers.wsgi.WSGIHandler()
    util.run_wsgi_app(application)
if __name__ == ' __main__':
    main()

eclipse run:
/usr/bin/python2.6 -u /home/elvis/google_appengine/dev_appserver.py

The PYTHONPATH that will be used is:

/home/elvis/.eclipse/org.eclipse.platform_3.5.0_155965261/plugins/org.python.pydev_1.5.4.2010011921/PySrc/pydev_sitecustomize:/home/elvis/workspace/pythonleggo:/home/elvis/google_appengine:/home/elvis/google_appengine/lib/webob:/home/elvis/google_appengine/lib/yaml/lib:/usr/lib/pymodules/python2.6:/usr/lib/pymodules/python2.6/gtk-2.0:/usr/lib/python2.6:/usr/lib/python2.6/dist-packages:/usr/lib/python2.6/dist-packages/PIL:/usr/lib/python2.6/dist-packages/gst-0.10:/usr/lib/python2.6/dist-packages/gtk-2.0:/usr/lib/python2.6/lib-dynload:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/plat-linux2:/usr/local/lib/python2.6/dist-packages


I could not get the settings file to load using os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘settings’ . It appeared to be stripped from the environ that django received. I used settings.configure which appeared to work correctly. At this point I only have the default django page loading in appspot.

👤jon

1👍

I’ve just started with Python and the Google App Engine today. I think we both banged our heads against the same wall with external referencing.

I’ve tried deploying the google-app-engine-django project for my app. I’ve extracted everything and I have under my root the /appengine_django and /django folder.

I’ve added them as source folders, and I’ve added the /google_appengine/google folder as an external reference.

Normally, this all made sense to me. Each contained the __ init __.py module. Still, when I tried to ctr+click on any of the import statements it couldn’t resolve the path to the modules.

Strikingly, you do not import the immediate folder that contains an __ init __.py. To properly reference packages you import the parent folder that contains the package duh! That also means that, since I didn’t want to use a /src folder, the actual project folder should be added as a source reference to get the /appengine_django and /django to be recognized as source folders.

With that done, everything is running smoothly. I guess it’s to show I have more reading up to do on Py.

0👍

Here is an other tutorial that might help.
The eclispe version might be a bit old but it should get you
far enough to get a working project.

http://django-appengine.com/contents

It has complete eclipse set up
http://django-appengine.com/post/37462709481/
http://www.mkyong.com/google-app-engine/google-app-engine-python-hello-world-example-using-eclipse/

It has complete gae set up
http://django-appengine.com/post/37615321945/

It has complete django set up
http://django-appengine.com/post/37628665099/

And then explains how to combine those two projects
into one gae project.
http://django-appengine.com/post/37778427717/

I hope this helps others who are just starting out

Leave a comment