Turbogears2: App not starting as sub-package

55 views Asked by At

I'm trying to deploy TurboGears as the sub-package frontend of my main application MainApp. Following, the structure of my project:

.
├── MainApp
│   ├── MainApp.egg-info
│   ├── backend
│   ├── frontend
│   └── __init__.py
├── LICENSE.txt
├── MANIFEST.in
├── README.md
├── development.ini
├── setup.cfg
├── setup.py
├── test.ini

Unfortunately, I always get an error when trying to start it with gearbox serve --reload --debug in the project folder:

pkg_resources.DistributionNotFound: The 'MainApp.frontend' distribution was not found and is required by the application

I understand that this is due to the definition in the development.ini:

[app:main]
use = egg:MainApp.frontend

I tried different alternatives, calling egg:MainApp or egg:frontend, also inside the MainApp folder with the development.ini copied over - nothing worked. What am I missing? Is this even possible?

Thanks you.

1

There are 1 answers

0
ckdo On

I found the solution myself.

Basically I did three things to solve this

  1. I used egg:MainApp in the development.ini
  2. I changed the packages in setup.py from packages=find_packages(where='MainApp', exclude=['ez_setup']) to packages=find_packages(exclude=['ez_setup'])
  3. I ran pip install -e . in the project folder again, which created the necessary .egg-info folder