sim3x: Я бы как бы и смирился, ну из за этого джанго админ падает ошибкой с кодировки.
БД создается для баз MySQL — cp1251, через cpanel Даже через dbshell выполнив предварительно set names utf8, селект все равно тот же, без юникода :(
@sim3x
Создал конфиг
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'chzat',
'USER': '*****',
'PASSWORD': '******',
'HOST': 'localhost', # Or an IP Address that your DB is hosted on
'PORT': '3306',
'OPTIONS': {
'read_default_file': '/home/c/chzat/my.cnf',
},
}
}
Перейти не могу так как sweb для WSGI поддерживает версию python 2.7.5. Подскажите как u'' использовать в моделях? Например у меня есть article_published = models.CharField(max_length=50, default= u'Не один пользователь не опубликвал статью', verbose_name='Опубликовал')
sim3x:
Теперь что то с юникодом
файл logfilename.log
Internal Server Error: /admin/
Traceback (most recent call last):
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/core/handlers/base.py", line 174, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/core/handlers/base.py", line 172, in get_response
response = response.render()
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/response.py", line 160, in render
self.content = self.rendered_content
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/response.py", line 137, in rendered_content
content = template.render(context, self._request)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/backends/django.py", line 95, in render
return self.template.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 206, in render
return self._render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
return self.nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
return compiled_parent._render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
return self.nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
return compiled_parent._render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
return self.nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/loader_tags.py", line 69, in render
result = block.nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/defaulttags.py", line 326, in render
return nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/defaulttags.py", line 168, in render
len_values = len(values)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/models/query.py", line 240, in __len__
self._fetch_all()
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/models/query.py", line 1074, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/models/query.py", line 52, in __iter__
results = compiler.execute_sql()
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
cursor.execute(sql, params)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 112, in execute
return self.cursor.execute(query, args)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
Internal Server Error: /admin/
Traceback (most recent call last):
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/core/handlers/base.py", line 174, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/core/handlers/base.py", line 172, in get_response
response = response.render()
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/response.py", line 160, in render
self.content = self.rendered_content
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/response.py", line 137, in rendered_content
content = template.render(context, self._request)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/backends/django.py", line 95, in render
return self.template.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 206, in render
return self._render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
return self.nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
return compiled_parent._render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
return self.nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
return compiled_parent._render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
return self.nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/loader_tags.py", line 69, in render
result = block.nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/defaulttags.py", line 326, in render
return nodelist.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/template/defaulttags.py", line 168, in render
len_values = len(values)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/models/query.py", line 240, in __len__
self._fetch_all()
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/models/query.py", line 1074, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/models/query.py", line 52, in __iter__
results = compiler.execute_sql()
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
cursor.execute(sql, params)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 112, in execute
return self.cursor.execute(query, args)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/home/c/chzat/.djangovenv/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
sim3x: logfilename.log создался пустой. Да у меня даже не появляется стандартная отладка сразу :
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
castaway.ru
Sat Mar 26 17:57:16 2016
Apache/2.2.29 (Gentoo) mod_dp/0.99.7 Phusion_Passenger/4.0.41 mod_wsgi/3.5 Python/2.7.7
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
Написано
Войдите на сайт
Чтобы задать вопрос и получить на него квалифицированный ответ.