我正在处理一个过去(非常!)已经过时但仍然使用Django 1.3.1的项目。计划是将这一点更新,但更迫切的是我们还希望将服务器从当前不可靠的主机切换到更现代的主机。我在使用Google Cloud Engine,特别是应用程序引擎方面有很好的经验,现在看来Google也提供CloudSQL似乎是一种很有吸引力的方式,所以我们不需要去django-nonrel路线。
我意识到app引擎不再支持1.3本地(https://cloud.google.com/appengine/docs/deprecations/django)但我认为通过将旧版本的django出售到lib/
目录中可以起作用。
我可以通过python2 myapp/manage.py runserver
运行此应用,但当我运行dev_appserver.py app.yaml
时,我会收到以下信息:
ERROR 2016-08-16 12:38:36,149 wsgi.py:279]
Traceback (most recent call last):
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 267, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/home/jamie/work/focus/website-git/lib/django/core/handlers/wsgi.py", line 272, in __call__
response = self.get_response(request)
File "/home/jamie/work/focus/website-git/lib/django/core/handlers/base.py", line 168, in get_response
receivers = signals.got_request_exception.send(sender=self.__class__, request=request)
File "/home/jamie/work/focus/website-git/lib/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/jamie/work/focus/website-git/lib/django/db/__init__.py", line 101, in _rollback_on_exception
transaction.rollback_unless_managed(using=conn)
File "/home/jamie/work/focus/website-git/lib/django/db/transaction.py", line 133, in rollback_unless_managed
connection.rollback_unless_managed()
File "/home/jamie/work/focus/website-git/lib/django/db/backends/__init__.py", line 193, in rollback_unless_managed
self._rollback()
File "/home/jamie/work/focus/website-git/lib/django/db/backends/mysql/base.py", line 331, in _rollback
BaseDatabaseWrapper._rollback(self)
File "/home/jamie/work/focus/website-git/lib/django/db/backends/__init__.py", line 50, in _rollback
return self.connection.rollback()
File "/home/jamie/work/focus/website-git/lib/pymysql/connections.py", line 711, in rollback
self._read_ok_packet()
File "/home/jamie/work/focus/website-git/lib/pymysql/connections.py", line 687, in _read_ok_packet
raise err.OperationalError(2014, "Command Out of Sync")
OperationalError: (2014, 'Command Out of Sync')
起初我认为这是一个数据库级别的问题,但是当我使用manage.py
时它工作正常,所以我不确定该怎么做。
由于某些固有的版本不匹配或者我错过了某些内容,这是否无法正常工作?希望django / app引擎专家可以加入。
如果有帮助,以下是其他特定于应用引擎的文件:
import django.core.handlers.wsgi
app = django.core.handlers.wsgi.WSGIHandler()
runtime: python27
api_version: 1
threadsafe: yes
env_variables:
DJANGO_SETTINGS_MODULE: 'myapp.settings'
handlers:
- url: /.*
script: main.app
from google.appengine.ext import vendor
vendor.add('lib')