0

A bit of context:

I am taking the CS50W course, and now I'm finishing the almost-completed django Mail single-app provided by the distribution code. Within that distribution code, aside from all python files necessary for the server-side, I have some templates and some static files - these last are causing me problems. For the purpose of this lab, I have no need to touch on a single line of python, everything was already made. I only need to implement new functionalities to a javascript file called inbox.js.

Real problem:

The problem is that any change that I make on that javascript file is not saved, even if am sure that I did it. I mean, my server simply returns the primer version of the .js file, like if any change hasn't been made on it.

This is my 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>`;
}
  

Can anyone help me out?

I've tried stopping and re-running my server but nothing changed. Even when a create new files on my static folder and save them, they are not returned by the server.

I also tried these two approaches: 1 - Why can't i edit css files and also use css in django templates? 2- How to change Django static files

Nonetheless, they were inefficient.

massam
  • 57
  • 6
Cauã
  • 31
  • 6

1 Answers1

0

I found the answer on this post: Django won't refresh staticfiles

All that was needed was to refresh the page but cleaning its cache before it.

Cauã
  • 31
  • 6