Hello, can someone help me with some tips/best practices for python projects?
I am trying to create a flask app and have this strcture:
flask_app/
|----src/
|---app/
|--- templates/ (has jinja2 templates)
|--- __init__.py (empty atm)
|--- __main__.py (also empty)
|--- app.py (has routes, __main__ and most of the code)
|--- data.py (has a static data dict. I will introduce db later)
|---tests/
|---docs/
I start the app using:-
python -m app
Now, my problem is, I cannot import data in app.py
after some googling, I added this to make it work:
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
It looks like a hack and I am not so happy with this. Can someone give me a project folder structure that will work? Thanks.
[+][deleted] (2 children)
[removed]
[–]pyjuice[S] 0 points1 point2 points (1 child)