django-nonrel 500 server error on Google App deployment

梦想与她 提交于 2019-12-24 16:19:42

问题


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 hello

urlpatterns = 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.


回答1:


Maybe try this:

from views import hello

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



来源:https://stackoverflow.com/questions/3348513/django-nonrel-500-server-error-on-google-app-deployment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!