【问题标题】:How to upload the django-1.5 application in google app engine?如何在谷歌应用引擎中上传 django-1.5 应用程序?
【发布时间】:2013-05-18 06:55:02
【问题描述】:

我已经在谷歌应用引擎中上传了我的示例 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

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

【问题讨论】:

    标签: python django google-app-engine yaml


    【解决方案1】:

    你会改变你的 Mysql 后端吗?

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

    编辑你的 settings.py:

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

    【讨论】:

    • 感谢回复,问题已解决。是的,我已经为我的项目启用了计费功能。但我尝试为这个应用程序创建实例,它显示计费未启用。请解决我的问题。谢谢...
    • 我检查了上面的代码,但它给出了未授权访问实例。谢谢
    猜你喜欢
    • 2013-05-19
    • 2012-05-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 2020-11-21
    • 1970-01-01
    • 2020-11-18
    相关资源
    最近更新 更多