我想用Django和Python制作双语言(意大利语和英语)网站。 我跟着this小教程,我陷入了疑问。
我不想对本网站的任何数据库(没有管理页面),所以我在settings.py删除的数据库设置部分,然后我激活“USE_I18N =真”和ugettext和一切。事实上,当我去本地主机它显示正确与两种语言翻译的/它/和/EN/的本地主机后放:8000。
我想,现在,要用于切换语言的按钮,添加djangoproject代码到我的模板文件,在这里:Django国际化静态网站
{% load i18n %}
<form action="{% url 'set_language' %}" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="{{ redirect_to }}" />
<select name="language">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
<input type="submit" value="Go" />
</form>
的问题是,当我选择从下拉语言下菜单,错误显示出来
ImproperlyConfigured at /it/i18n/setlang/
settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
Request Method: POST
Request URL: http://localhost:8000/it/i18n/setlang/
Django Version: 1.8.2
Exception Type: ImproperlyConfigured
Exception Value:
settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
这里的应用程序树:
sito_personale --- locale --- en --- LC_MESSAGES --- django.mo
--- django.po
--- it --- LC_MESSAGES --- django.mo
--- django.po
--- pages --- migration
--- static
--- templates
--- sito_personale
--- manage.py
有什么我可以做的解决这个问题?
我真的很感谢您能提供任何帮助。
你能提供你的设置?我想它与如何存储语言首选项有关^^ – spectras
你的意思是整个settings.py代码?如果是这样的话,你在这里:http://codepad.org/7xUdEGKv 我觉得有可能是某种在urls.py错误太:http://codepad.org/pkUn1xI4 –