Frappe.init() returning 404

Hi everyone,

I wanted to create a document by using Document API, but it is returning me 404 Error that site does not exists. don’t know why this error is showing up, because I have the site in my frappe and I have set it as default site.

Note: I’m running this python file in frappe-bench/sites folder.

Here is my code:

import frappe

def create_job_applicant(data):
    def get_value(key, default="Not Mentioned"):
        return data.get(key, default)

    doc = frappe.get_doc({
        "doctype": "Job Applicant", 
        "applicant_name": get_value("Candidate Name:"),
        "status": "Open",
        "job_title": get_value("Role:"),
        "client": get_value("Client:"),
        "phone_number": get_value("Mobile"),
        "email_id": get_value("Email"),
        "source": "Naukri",
        "lower_range": get_value("Current Salary:"),
        "upper_range": get_value("Expected Salary:"),
        "resume_attachment": "/private/files/Kunjesh_Resume.pdf"
    doc.insert(ignore_permissions=True, ignore_mandatory=True)
    # frappe.db.commit()

    # frappe.destroy()
    return f"Document Created Successfully for Candidate: {get_value('Candidate Name:')}"


<!doctype html>

<html lang=en>

<title>404 Not Found</title>

<h1>Not Found</h1>

<p> does not exist</p>```