0

I am building a project with 2 components:

  • An event listener
  • An API

For both components to work, they need to use an internal library I build that is the network connector.

So the project structure is like:

src
 --listener_app
      --__init__.py
      --listener.py
 --api
      --__init__.py
      --main.py
 --network_connector_app
      --__init__.py
      --network.py
 --settings.py
 --requirements.txt (for the venv)

So basically:

  • the listener.py connects to the network for listen to events through the network.py, and when read an event, it saves the event in a ddbb through the API (main.py).
  • the main.py exposes endpoints that interacts with a ddbb, and some of them that retrieves data from the network through the networks.py

So you can see that both components depends on the network_connector package.

Having said that,my doubts are:

  1. I want to all of them share the same settings file where i can for example define the logging configuration. Is that a good practice? Or should I separate the settings file, one per each component? Also when I try to use 1 settings file as defined above, i cannot import the settings file in any of the 3 components. Any ideas why?

  2. Is a good practice for the listener.py to use the API to save the data in the database, or should i perform this action within the listener_app? As the api is going to be a service also exposed to users?

Many thanks,

0 Answers0