My life with python is just started. I am clueless about how to organize folders in python(flask)
My intention is to organize my application in following directory/file structure
server.py
is the main file
database.py
holding DB related sharable resources
customer.py
is a simple python class which need DB instance from database.py
from ....shared.database import DB # How to solve this
class Customer():
def __init__(self):
self._first_name="John"
but I am getting an error Attempted relative import beyond top-level package
How do I make this works?!.
folder strucure representation
src
app
/modules
/customers
/models
customer.py
/shared
/database.py
/server.py