Google 应用部署上的 django-nonrel 500 服务器错误
我是一个新手,在 Google App Engine 上使用 Django-nonrel 时遇到问题。
我创建了一个名为“helloapp”的新应用程序。
1)我在views.py中创建了一个名为hello world的视图:
从 django.http 导入 HttpResponse
def 你好(请求):
返回 HttpResponse("Hello world")
2)然后我使用以下方法在 urls.py 中链接到它:
从 django.conf.urls.defaults 导入 *
从 helloapp.views 导入 hello
urlpatterns = 模式('',
(r'^你好/$',你好),
)
这在本地工作正常,但在现场我收到 500 服务器错误。
在 GAE 日志中,我看到出现导入错误
ImportError: No module named helloapp.views
这很令人困惑,因为如上所述,这在本地工作得很好。
帮助。
I am a newbie with a problem working with Django-nonrel on Google App Engine.
I created a new app called "helloapp".
1) I have created a view in views.py called hello world:
from django.http import HttpResponse
def hello(request):
return HttpResponse("Hello world")
2) I have then linked to it in the urls.py using:
from django.conf.urls.defaults import *
from helloapp.views import hellourlpatterns = patterns('',
(r'^hello/$',hello),
)
This works fine locally, but on live I am getting 500 Server error.
In the GAE logs I see that I am getting an import error
ImportError: No module named helloapp.views
This is confusing since, as mentioned, this works fine locally.
Help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许试试这个:
本地的views.py 位于helloapp 目录中。但是,当它上传到应用程序引擎时,它会被放置到具有如下版本号的目录中,其中 helloapp.views 不存在:
/base/data/home/apps/helloapp/1.23456789/views.py
Maybe try this:
Locally your views.py is in a helloapp directory. But when it gets uploaded onto app engine it is placed into a directory with a version number like this, where helloapp.views does not exist:
/base/data/home/apps/helloapp/1.23456789/views.py