My JavaScript file will run from one html file, but not from another in the same directory

Both friends.html and homepage.html are in the same folder. Homepage can access friends.js just fine but when I try to access it from friends.html it gives me this error: GET http://127.0.0.1:8000/homepage/static/js/friends.js net::ERR_ABORTED 404 (Not Found)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    {% load static %}
    <link rel="stylesheet" href="{% static 'css/friends.css' %}">
</head>
<body>
    <div class="ui-wrapper">
        <div class="friend_request">
            <textarea name="" id="" cols="30" rows="1"></textarea>
        </div>
    
    </div>
    
    <script src="../../static/js/jQuery.js"></script>
    <script src="../static/js/friends.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    {% load static %}
    <link rel="stylesheet" href="{% static 'css/spinner.css' %}">
    <link rel="stylesheet" href="{% static 'css/mainpage.css' %}">
    <link rel="stylesheet" href="{% static 'css/background.css' %}">
    <link rel="stylesheet" href="{% static 'css/output.css' %}">
    
    {% if newuser %}
    <link rel="stylesheet" href="{% static 'css/instructions.css' %}">
    {% endif %}
</head>
<body>
    <a href="{% url 'friends' %}">
        <button class="title-btn fade-in" id="friends-btn" onclick="friends_tab()">Friends >></button>
    </a>


    <!-- django to js variables -->
    <script data-newuser="{{ newuser }}">
        window.CSRF_TOKEN = "{{ csrf_token }}"; 
        const data = document.currentScript.dataset;
        const isNewUser = data.newuser == 'True';
    </script>

    <script src="../../static/js/jQuery.js"></script>
    <script src="../static/js/mainpage.js"></script>
    <script src="../static/js/friends.js"></script>
</body>
</html>
@login_required
def friends(request):
    return render(request, 'friends.html')
Back to Top