django无法在app引擎上导入名称模式,因为app在heroku上工作正常但不在app引擎上工作

时间:2014-09-15 10:22:07

标签: django google-app-engine

我正在学习django,我已经在heroku上部署了它在这里工作正常它是链接http://whispering-bayou-9769.herokuapp.com/但是在app引擎上它不起作用给我错误 500请再试几次

它是应用引擎http://djangocomment.appspot.com/

的网址

请帮助我,我认为这可能是app.yml的问题,因为在app引擎日志上有日志告诉我错误

' exceptions.ImportError'>:无法导入名称模式我检查url.py已经可以使用heroku了

在app.yml我有wriiten

application: djangocomment
runtime: python
version: 1
api_version: 1

handlers:
- url: .*
  script: /post/urls.py


env_variables:
  DJANGO_SETTINGS_MODULE: 'post.settings'

urls.p [post文件夹中的y包含路径

文件结构

app/
   build/


   categopry/
     admin.py
    templates/
    models.py
    urls.py
    tests.py
  post/
    urls.py
    forms.py
    settings.py
    wsgi.py

   static/
    admin.py
    templates/
    models.py
    urls.py
    tests.py

   template/
      registration/

   userprofile/
     admin.py
    templates/
    models.py
    urls.py
    tests.py

   app.yml

  manage.py
  procfile
  README.md
  requiremtn.txt

1 个答案:

答案 0 :(得分:1)

这真的不是你如何在GAE上运行Django应用程序。是什么让你想到将脚本指向urls.py?

首先,您需要在app.yaml的libraries设置中引用Django。然后,您需要将script设置为项目的wsgi.py文件中的WSGI对象:可能类似于post.wsgi.app。见the documentation