将应用程序移动到新服务器

发布于 2024-10-31 04:45:01 字数 5906 浏览 3 评论 0原文

我必须将应用程序从一台服务器移动到另一台服务器。它也是 debian,所以我安装了旧服务器上安装的所有 python 软件包,然后将文件移动到相同的目录中(我希望:D)

当我尝试检查它是否有效时,我收到这样的错误:

URI:            '/'
Location:       '/'
Directory:      None
Filename:       '/var/www/'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py", line 228, in handler
    return ModPythonHandler()(req)

  File "/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py", line 201, in __call__
    response = self.get_response(request)

  File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 141, in get_response
    return self.handle_uncaught_exception(request, resolver, sys.exc_info())

  File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 165, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)

  File "/usr/lib/pymodules/python2.6/django/views/debug.py", line 58, in technical_500_response
    html = reporter.get_traceback_html()

  File "/usr/lib/pymodules/python2.6/django/views/debug.py", line 137, in get_traceback_html
    return t.render(c)

  File "/usr/lib/pymodules/python2.6/django/template/__init__.py", line 173, in render
    return self._render(context)

  File "/usr/lib/pymodules/python2.6/django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)

  File "/usr/lib/pymodules/python2.6/django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/pymodules/python2.6/django/template/debug.py", line 72, in render_node
    result = node.render(context)

  File "/usr/lib/pymodules/python2.6/django/template/debug.py", line 89, in render
    output = self.filter_expression.resolve(context)

  File "/usr/lib/pymodules/python2.6/django/template/__init__.py", line 579, in resolve
    new_obj = func(obj, *arg_vals)

  File "/usr/lib/pymodules/python2.6/django/template/defaultfilters.py", line 697, in date
    return format(value, arg)

  File "/usr/lib/pymodules/python2.6/django/utils/dateformat.py", line 281, in format
    return df.format(format_string)

  File "/usr/lib/pymodules/python2.6/django/utils/dateformat.py", line 30, in format
    pieces.append(force_unicode(getattr(self, piece)()))

  File "/usr/lib/pymodules/python2.6/django/utils/dateformat.py", line 187, in r
    return self.format('D, j M Y H:i:s O')

  File "/usr/lib/pymodules/python2.6/django/utils/dateformat.py", line 30, in format
    pieces.append(force_unicode(getattr(self, piece)()))

  File "/usr/lib/pymodules/python2.6/django/utils/encoding.py", line 66, in force_unicode
    s = unicode(s)

  File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 206, in __unicode_cast
    return self.__func(*self.__args, **self.__kw)

  File "/usr/lib/pymodules/python2.6/django/utils/translation/__init__.py", line 55, in ugettext
    return real_ugettext(message)

  File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 55, in _curried
    return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))

  File "/usr/lib/pymodules/python2.6/django/utils/translation/__init__.py", line 36, in delayed_loader
    return getattr(trans, real_name)(*args, **kwargs)

  File "/usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py", line 276, in ugettext
    return do_translate(message, 'ugettext')

  File "/usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py", line 266, in do_translate
    _default = translation(settings.LANGUAGE_CODE)

  File "/usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py", line 176, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)

  File "/usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py", line 159, in _fetch
    app = import_module(appname)

  File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
    __import__(name)

  File "/usr/lib/pymodules/python2.6/django/contrib/admin/__init__.py", line 1, in <module>
    from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME

  File "/usr/lib/pymodules/python2.6/django/contrib/admin/helpers.py", line 1, in <module>
    from django import forms

  File "/usr/lib/pymodules/python2.6/django/forms/__init__.py", line 17, in <module>
    from models import *

  File "/usr/lib/pymodules/python2.6/django/forms/models.py", line 6, in <module>
    from django.db import connections

  File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 77, in <module>
    connection = connections[DEFAULT_DB_ALIAS]

  File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 91, in __getitem__
    backend = load_backend(db['ENGINE'])

  File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 49, in load_backend
    raise ImproperlyConfigured(error_msg)

TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql' isn't an available database backend. 
Try using django.db.backends.XXX, where XXX is one of:
    'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: cannot import name utils

我不知道我忘记了什么安装。不幸的是 - 在移动之前无法检查它是否正常工作(旧服务器已关闭)。为了更好地理解 - 应用程序很久以前就可以正常工作。比有一些 apt-get dist-upgrade 可能会出现此错误。今天我想使用该应用程序,我发现服务器肯定已关闭,因此我将所有内容都移至新服务器(很高兴,硬盘仍然有效)。

I have to move app from one server to another. It's also debian, so I install all python packages which are installed on old server, then move files into the same directories (i hope :D)

When I try to check if it works I receive such error:

URI:            '/'
Location:       '/'
Directory:      None
Filename:       '/var/www/'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py", line 228, in handler
    return ModPythonHandler()(req)

  File "/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py", line 201, in __call__
    response = self.get_response(request)

  File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 141, in get_response
    return self.handle_uncaught_exception(request, resolver, sys.exc_info())

  File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 165, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)

  File "/usr/lib/pymodules/python2.6/django/views/debug.py", line 58, in technical_500_response
    html = reporter.get_traceback_html()

  File "/usr/lib/pymodules/python2.6/django/views/debug.py", line 137, in get_traceback_html
    return t.render(c)

  File "/usr/lib/pymodules/python2.6/django/template/__init__.py", line 173, in render
    return self._render(context)

  File "/usr/lib/pymodules/python2.6/django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)

  File "/usr/lib/pymodules/python2.6/django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/pymodules/python2.6/django/template/debug.py", line 72, in render_node
    result = node.render(context)

  File "/usr/lib/pymodules/python2.6/django/template/debug.py", line 89, in render
    output = self.filter_expression.resolve(context)

  File "/usr/lib/pymodules/python2.6/django/template/__init__.py", line 579, in resolve
    new_obj = func(obj, *arg_vals)

  File "/usr/lib/pymodules/python2.6/django/template/defaultfilters.py", line 697, in date
    return format(value, arg)

  File "/usr/lib/pymodules/python2.6/django/utils/dateformat.py", line 281, in format
    return df.format(format_string)

  File "/usr/lib/pymodules/python2.6/django/utils/dateformat.py", line 30, in format
    pieces.append(force_unicode(getattr(self, piece)()))

  File "/usr/lib/pymodules/python2.6/django/utils/dateformat.py", line 187, in r
    return self.format('D, j M Y H:i:s O')

  File "/usr/lib/pymodules/python2.6/django/utils/dateformat.py", line 30, in format
    pieces.append(force_unicode(getattr(self, piece)()))

  File "/usr/lib/pymodules/python2.6/django/utils/encoding.py", line 66, in force_unicode
    s = unicode(s)

  File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 206, in __unicode_cast
    return self.__func(*self.__args, **self.__kw)

  File "/usr/lib/pymodules/python2.6/django/utils/translation/__init__.py", line 55, in ugettext
    return real_ugettext(message)

  File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 55, in _curried
    return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))

  File "/usr/lib/pymodules/python2.6/django/utils/translation/__init__.py", line 36, in delayed_loader
    return getattr(trans, real_name)(*args, **kwargs)

  File "/usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py", line 276, in ugettext
    return do_translate(message, 'ugettext')

  File "/usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py", line 266, in do_translate
    _default = translation(settings.LANGUAGE_CODE)

  File "/usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py", line 176, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)

  File "/usr/lib/pymodules/python2.6/django/utils/translation/trans_real.py", line 159, in _fetch
    app = import_module(appname)

  File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
    __import__(name)

  File "/usr/lib/pymodules/python2.6/django/contrib/admin/__init__.py", line 1, in <module>
    from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME

  File "/usr/lib/pymodules/python2.6/django/contrib/admin/helpers.py", line 1, in <module>
    from django import forms

  File "/usr/lib/pymodules/python2.6/django/forms/__init__.py", line 17, in <module>
    from models import *

  File "/usr/lib/pymodules/python2.6/django/forms/models.py", line 6, in <module>
    from django.db import connections

  File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 77, in <module>
    connection = connections[DEFAULT_DB_ALIAS]

  File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 91, in __getitem__
    backend = load_backend(db['ENGINE'])

  File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 49, in load_backend
    raise ImproperlyConfigured(error_msg)

TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql' isn't an available database backend. 
Try using django.db.backends.XXX, where XXX is one of:
    'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: cannot import name utils

I have no idea what I forgot to install. Unfortunately - there's no possibility to check if it works before moving (old server is down). To good understanding - app long time ago works correctly. Than there was some apt-get dist-upgrade, which could make this error. Today I want to use the app, and I see that server is definetely down, so I moved all to new one (being happy, that hdd still works).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只怪假的太真实 2024-11-07 04:45:01

您是否安装了 postgresql ?它是一个数据库服务器,并且出现此错误:

TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql' isn't an available database backend.

表示它不可用。

Do you have postgresql installed? It's a database server, and this error:

TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql' isn't an available database backend.

says that it's not available.

梦冥 2024-11-07 04:45:01

阅读源码!

来自 django/db/backends/postgresql/base.py

"""
Django 的 PostgreSQL 数据库后端。

需要 psycopg 1:http://initd.org/projects/psycopg1
"""

您可能缺少 psycopg - 用于 python 的(旧)postgres 连接器。

不过,我建议安装 psycopg2 并使用 postgresql_psycopg2 后端。

Read the source!

from django/db/backends/postgresql/base.py

"""
PostgreSQL database backend for Django.

Requires psycopg 1: http://initd.org/projects/psycopg1
"""

You are probably missing psycopg - the (old) postgres connector for python.

I'd recommend installing psycopg2 and using the postgresql_psycopg2 backend though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文