Package directory question

Robert Latest robert.latest at 1
Sun Jun 24 14:58:30 EDT 2018


From: Robert Latest <boblatest at yahoo.com>

Hello,

I'm building an application which consists of two largely distinct parts, a
frontend and a backend. The directory layout is like this:

|-- jobwatch
|   |-- backend
|   |   |-- backend.py
|   |   |-- __init__.py
|   |   `-- tables.py
|   |-- frontend
|   |   |-- __init__.py
|   |   |-- main.py
|   `-- __init__.py
`-- setup.py

Because the main.py script needs to import the tables.py module from backend, I
 put this at the top if main.py:

   sys.path.append('../..')
   import jobwatch.backend.tables as tables

My question is: Is this the way it should be done? It looks fishy. The only
alternative I could come up with is to put a symlink to tables.py into the
frontend directory, which also seems fishy. Eventually I want to package all
this up neatly to be able to use only little wrapper scripts for the backend
(running as a service) and the frontend (a wsgi app).

Any thoughts?

Thanks
robert

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)



More information about the Python-list mailing list