我知道这个问题已经被问了几次了,但是我基本上遍历了所有关于堆栈溢出的内容,但仍然无法解决这个问题。现在,我只是尝试简单地更改管理站点标题。我有以下几点:
#base_site.html
{% extends "admin/base_site.html" %}
{% block title %}{{ title }} | {{ site_title|default:_('NEW TITLE') }}{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('NEW TITLE') }}</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %}
Run Code Online (Sandbox Code Playgroud)
我试图把它放进去
my_site / templates / admin / base_site.html,
my_site / templates / admin / my_app / base_site.html,以及
my_site / my_app / templates / admin / base_site.html,
但这些都不起作用。
settings.py:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'OPTIONS': { …Run Code Online (Sandbox Code Playgroud) 我试图将在一个视图中获得的查询结果保存到会话中,并在另一个视图中检索它,所以我尝试了以下操作:
def default (request):
equipment_list = Equipment.objects.all()
request.session['export_querset'] = equipment_list
Run Code Online (Sandbox Code Playgroud)
但是,这给了我
TypeError at /calbase/
<QuerySet [<Equipment: A>, <Equipment: B>, <Equipment: C>]> is not JSON serializable
Run Code Online (Sandbox Code Playgroud)
我想知道这到底是什么意思,我应该怎么做?也许除了使用会话之外,还有其他方法可以做我想要的事情?
所以我正在尝试部署我的网站并且基本上尝试过
python manage.py check --deploy
Run Code Online (Sandbox Code Playgroud)
并遵循它告诉我的一切:
WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems.
?: (security.W006) Your SECURE_CONTENT_TYPE_NOSNIFF setting is not set to True, so your pages will not be served with an 'x-content-type-options: nosniff' header. You …Run Code Online (Sandbox Code Playgroud)