'How to define 'p' with ROOT' using Python and Flask : I am trying to launch a full stack web application using Python and Flask and inside my server interface/top layer file the ROOT line with 'p' is saying that it is not defined. Is there another set of variables I can assign to it in the same file to solve the problem when attempting to launch in terminal?

I have already tried launching with different versions of Python in terminal and assigning p to path in the code but then it says user isn't defined.


import sqlite3 as sql
from os import path

    ROOT = path.dirname(p/Users/matthewdeyn/Coffea/app.pyath.relpath((__file__)))

    def create_post(name, content):
        con = sql.connect(path.join(ROOT, 'database.db'))
        cur = con.cursor()
        cur.execute('insert into posts (name, content) values(?, ?)', (name, content))
        con.commit()
        con.close()
    
    def get_posts():
        con = sql.connect(path.join(ROOT, 'database.db'))
        cur = con.cursor()
        cur.execute('select * from posts')
        posts = cur.fetchall()
        return posts


Expected results are that the app.py file will load in terminal and I will know where to find it in the browser.

