一些背景:
我正在学习 CS50W 课程,现在我正在完成分发代码提供的几乎完成的 django Mail 单应用程序。在该分发代码中,除了服务器端所需的所有 python 文件之外,我还有一些模板和一些静态文件 - 最后这些文件给我带来了问题。为了本实验的目的,我不需要接触任何 Python 代码,一切都已经做好了。我只需要为名为 inbox.js 的 javascript 文件实现新功能。
真正的问题:
问题是我对该 javascript 文件所做的任何更改都不会保存,即使我确信我做到了。我的意思是,我的服务器只是返回 .js 文件的初级版本,就像如果尚未对其进行任何更改。
这是我的 inbox.js:
document.addEventListener('DOMContentLoaded', function() {
// Use buttons to toggle between views
document.querySelector('#inbox').addEventListener('click', () => load_mailbox('inbox'));
document.querySelector('#sent').addEventListener('click', () => load_mailbox('sent'));
document.querySelector('#archived').addEventListener('click', () => load_mailbox('archive'));
document.querySelector('#compose').addEventListener('click', compose_email);
// By default, load the inbox
load_mailbox('inbox');
});
function compose_email() {
// Show compose view and hide other views
document.querySelector('#emails-view').style.display = 'none';
document.querySelector('#compose-view').style.display = 'block';
// Clear out composition fields
document.querySelector('#compose-recipients').value = '';
document.querySelector('#compose-subject').value = '';
document.querySelector('#compose-body').value = '';
}
function load_mailbox(mailbox) {
// Show the mailbox and hide other views
document.querySelector('#emails-view').style.display = 'block';
document.querySelector('#compose-view').style.display = 'none';
// Show the mailbox name
document.querySelector('#emails-view').innerHTML = `<h3>${mailbox.charAt(0).toUpperCase() + mailbox.slice(1)}</h3>`;
}
有人可以帮我吗?我尝试停止并重新运行我的服务器,但没有任何改变。
即使在我的静态文件夹上创建新文件并保存它们,服务器也不会返回。
我也尝试过这两种方法: 1 -为什么我无法编辑 css 文件并在 django 模板中使用 css? 2- 如何更改 Django 静态文件
尽管如此,他们的效率还是很低。