姜戈 + Pydev/Eclipse + Google App Engine - 可能吗?

发布于 2024-07-13 06:41:00 字数 261 浏览 7 评论 0原文

有谁能够让 Google App Engine/Django 在 Pydev/Eclipse 中工作吗? 我尝试了这个,但很难让 Pydev 识别我引用的所有外部链接文件夹(django 插件)。 我最终将所有这些文件夹全部复制到项目中,而不是引用它们,导致项目文件夹变得非常臃肿——这确实是一个行不通的解决方案,最终让我放弃了整个项目。 所以,我想知道是否有人尝试过这个或者知道我可能做错了什么。 (请记住,这是我第一次尝试使用 Pydev、Django、App Engine 和 Python!)

Has anyone been able to get Google App Engine/Django working in Pydev/Eclipse? I tried this but had difficulty getting Pydev to recognize all of the externally linked folders (django plugins) that I was referencing. I ended up copying all of those folders into the project en masse, rather than referencing them, resulting in a massively bloated project folder - it was really an unworkable solution that eventually made me give up the whole project. So, I'm wondering if anyone has tried this or has any idea what I might have been doing wrong. (Keep in mind this was my first attempt at using Pydev, Django, App Engine and Python!!)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

终陌 2024-07-20 06:41:00

我没有亲自设置它,但我确实看到了有关如何设置的教程:

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

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

这样的小城市 2024-07-20 06:41:00

Pydev 1.4.6(仍然仅在夜间版本中可用)有一些特殊的支持,以方便配置。 请参阅:http://pydev。 blogspot.com/2009/05/testing-on-pydev-146-google-app-engine.html

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

一场信仰旅途 2024-07-20 06:41:00

本教程展示如何将 Aptana(安装了 PyDev)配置为 AppEngine 的编码和调试平台。 同样,您也可以将 Django 库添加到 Aptana。

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

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/

绮烟 2024-07-20 06:41:00

这个问题已经有一段时间没有得到答复了,事情已经发生了变化,所以我想我会提供并更新。

PyDev 现在包含开箱即用的 Google App Engine 配置,您可以开箱即用地调试和运行 GAE 项目,其中包括 Django。

只需在您的计算机上安装 GAE 和最新的 Eclipse/PyDev,然后创建一个 GAE 项目并将 PyDev 指向您的 Python 和 Google App Engine 版本。

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.

醉生梦死 2024-07-20 06:41:00

应用引擎 1.31
Django 1.1
pydev 1.5.4
操作系统 Ubuntu 9.10


eclipse .pydevproject 文件:

<?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>

文件:

eclipse 项目文件夹
-app.yaml
-index.yaml
- init.py
- main.py
- 管理.py
- .项目
- .pydevproject
- settings.py(无法加载)
- urls.py


main.py:eclipse

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', '[email protected]'),
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()

运行:
/usr/bin/python2.6 -u /home/elvis/google_appengine/dev_appserver.py

将使用的 PYTHONPATH 为:

/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


我无法使用 os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' 加载设置文件。 它似乎从 django 接收到的环境中剥离出来。 我使用了 settings.configure ,它似乎工作正常。 此时我只有在 appspot 中加载默认的 django 页面。

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', '[email protected]'),
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.

蓝眸 2024-07-20 06:41:00

我最初链接到本教程 。 Pydev 现在支持 Django,因此这可能不太相关。 不过,对于弄清楚如何使它们一起工作仍然可能有用。 您还可以尝试查看 这篇博文

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.

夏尔 2024-07-20 06:41:00

我今天刚刚开始使用 Python 和 Google App Engine。 我认为我们都用外部参考将头撞到了同一堵墙上。

我尝试部署 google-app-engine-django我的应用程序的项目。 我已经提取了所有内容,并且在我的根目录下有 /appengine_django 和 /django 文件夹。

我已将它们添加为源文件夹,并将 /google_appengine/google 文件夹添加为外部引用。

通常,这对我来说都是有意义的。 每个都包含 __ init __.py 模块。 尽管如此,当我尝试按住ctr并单击任何导入语句时,它无法解析模块的路径。

引人注目的是,您不会导入包含 __ init __.py 的直接文件夹。 要正确引用包,您需要导入包含包的父文件夹 duh! 这也意味着,由于我不想使用 /src 文件夹,因此应将实际的项目文件夹添加为源参考将 /appengine_django 和 /django 识别为源文件夹。

完成此操作后,一切都会顺利进行。 我想这是为了表明我在 Py 上还有更多的阅读要做。

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.

尐偏执 2024-07-20 06:41:00

这是另一个可能有帮助的教程。
eclispe 版本可能有点旧,但应该可以帮助您
足够远以获得一个可行的项目。

http://django-appengine.com/contents

它已完成 Eclipse 设置
http://django-appengine.com/post/37462709481/
http:// www.mkyong.com/google-app-engine/google-app-engine-python-hello-world-example-using-eclipse/

它已经完成了gae设置
http://django-appengine.com/post/37615321945/

它已完成 django 设置
http://django-appengine.com/post/37628665099/

然后解释了如何组合这两个项目
整合到一个 gae 项目中。
http://django-appengine.com/post/37778427717/

我希望这可以帮助其他人才刚刚开始

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文