开发者

moving app to new server

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 ap开发者_如何学Cp, and I see that server is definetely down, so I moved all to new one (being happy, that hdd still works).


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜