如何在谷歌应用引擎中上传django-1.5应用程序?

时间:2013-05-23 03:10:17

标签: python django google-app-engine yaml

我已将我的示例CRUD应用程序上传到谷歌应用引擎中。但它如图所示出现错误,

 Traceback (most recent call last):
  File "/base/data/home/apps/s~mobiheropython/1.367549640437962894/main.py", line 52, in <module>
    main()
  File "/base/data/home/apps/s~mobiheropython/1.367549640437962894/main.py", line 49, in main
    util.run_wsgi_app(application)
  File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/webapp/util.py", line 98, in run_wsgi_app
    run_bare_wsgi_app(add_wsgi_middleware(application))
  File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/webapp/util.py", line 116, in run_bare_wsgi_app
    result = application(env, _start_response)
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/core/handlers/wsgi.py", line 236, in __call__
    self.load_middleware()
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/core/handlers/base.py", line 51, in load_middleware
    mod = import_module(mw_module)
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/contrib/auth/middleware.py", line 3, in <module>
    from django.contrib.auth.backends import RemoteUserBackend
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/contrib/auth/backends.py", line 3, in <module>
    from django.contrib.auth.models import Permission
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/contrib/auth/models.py", line 8, in <module>
    from django.db import models
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/db/__init__.py", line 40, in <module>
    backend = load_backend(connection.settings_dict['ENGINE'])
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/db/__init__.py", line 34, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/db/utils.py", line 27, in load_backend
    return import_module('.base', backend_name)
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/python27_runtime/python27_lib/versions/third_party/django-1.5/django/db/backends/mysql/base.py", line 17, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

我的app结构如下所示,

    mobihero
├── app.yaml
├── app.yaml~
├── favicon.ico
├── index.yaml
├── main.py
├── main.py~
├── main.pyc
├── manage.py
├── mobitracking
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── settings.py
│   ├── settings.py~
│   ├── settings.pyc
│   ├── urls.py
│   ├── urls.pyc
│   ├── wsgi.py
│   └── wsgi.pyc
├── nohup.out
├── Procfile
├── requirements.txt
├── shipment
│   ├── admin.py
│   ├── admin.pyc
│   ├── forms.py
│   ├── forms.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── tests.py
│   ├── views.py
│   └── views.pyc
├── static
│   ├── css
│   │   ├── bootstrap.css
│   │   └── styles.css
│   └── jquery
│       ├── jquery-1.9.1.js
│       ├── jquery-ui-1.10.1.custom.min.js
│       ├── ui-darkness
│       │   ├── images
│       │   │   ├── animated-overlay.gif
│       │   │   ├── ui-bg_flat_30_cccccc_40x100.png
│       │   │   ├── ui-bg_flat_50_5c5c5c_40x100.png
│       │   │   ├── ui-bg_glass_20_555555_1x400.png
│       │   │   ├── ui-bg_glass_40_0078a3_1x400.png
│       │   │   ├── ui-bg_glass_40_ffc73d_1x400.png
│       │   │   ├── ui-bg_gloss-wave_25_333333_500x100.png
│       │   │   ├── ui-bg_highlight-soft_80_eeeeee_1x100.png
│       │   │   ├── ui-bg_inset-soft_25_000000_1x100.png
│       │   │   ├── ui-bg_inset-soft_30_f58400_1x100.png
│       │   │   ├── ui-icons_222222_256x240.png
│       │   │   ├── ui-icons_4b8e0b_256x240.png
│       │   │   ├── ui-icons_a83300_256x240.png
│       │   │   ├── ui-icons_cccccc_256x240.png
│       │   │   └── ui-icons_ffffff_256x240.png
│       │   ├── jquery-ui-1.10.1.custom.css
│       │   └── jquery-ui-1.10.1.custom.min.css
│       └── ui-lightness
│           ├── images
│           │   ├── animated-overlay.gif
│           │   ├── ui-bg_diagonals-thick_18_b81900_40x40.png
│           │   ├── ui-bg_diagonals-thick_20_666666_40x40.png
│           │   ├── ui-bg_flat_10_000000_40x100.png
│           │   ├── ui-bg_glass_100_f6f6f6_1x400.png
│           │   ├── ui-bg_glass_100_fdf5ce_1x400.png
│           │   ├── ui-bg_glass_65_ffffff_1x400.png
│           │   ├── ui-bg_gloss-wave_35_f6a828_500x100.png
│           │   ├── ui-bg_highlight-soft_100_eeeeee_1x100.png
│           │   ├── ui-bg_highlight-soft_75_ffe45c_1x100.png
│           │   ├── ui-icons_222222_256x240.png
│           │   ├── ui-icons_228ef1_256x240.png
│           │   ├── ui-icons_ef8c08_256x240.png
│           │   ├── ui-icons_ffd27a_256x240.png
│           │   └── ui-icons_ffffff_256x240.png
│           ├── jquery-ui-1.10.2.custom.css
│           └── jquery-ui-1.10.2.custom.min.css
└── templates
    ├── add_shipment.html
    ├── all_shipments.html
    ├── base.html
    ├── home.html
    ├── search.html
    ├── shipment
    │   └── shipment_confirm_delete.html
    ├── shipment_detail.html
    └── update_shipment.html

我已使用如下所示的命令上传代码,

appcfg.py更新mobihero

已成功部署。 请解决我的问题。谢谢......

1 个答案:

答案 0 :(得分:1)

您是否更改了Mysql后端?

  

自定义Django数据库后端提供了对Django使用Google Cloud SQL的支持,该后端包装了Django的MySQL后端。

编辑您的settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'google.appengine.ext.django.backends.rdbms',
        'INSTANCE': 'my_project:instance1',
        'NAME': 'my_database',
    }
}