mara / mara-app

A framework for distributing flask apps across separate packages with minimal dependencies
MIT License
15 stars 4 forks source link

App config does not show up when mara packages are installed directly into the venv #8

Closed ghost closed 7 years ago

ghost commented 7 years ago

The problem is the automatic config which assumes that the app is in the same directory as the parent of the mara-app package: https://github.com/mara/mara-app/blob/master/mara_app/views.py#L21. This isn't true in case where the mara packages were installed directly into the venv.

I need to install the package into the venv, because I want to have one venv/directory per requirements.txt.freeze file and one directory per commit of the main app. The final tree looks like this:

venv/requirements.txt.freeze-hash1/... # python venv
venv/requirements.txt.freeze-hash2/...
...
commit/commit-id1/... # the whole checked out commit
commit/commit-id1/.venv # symlink to venv/requirements.txt.freeze-hash1
...
current # symlink to commit/commit-id1/

The app is then started by calling ./current/.venv/bin/python ...

If I use the supplied makefile, which installs the mara package into the package directory instead of the venv, pip installs/"links" these packages into the venv with absolute path, so switching current to commit/commit-id2/ still loads mara packages from commit/commit-id1/.

martin-loetzsch commented 7 years ago

Fixed in 111bb8b.

Configuration modules now need to be implicitly marked by listing them in MARA_CONFIG_MODULES variables, e.g.

MARA_CONFIG_MODULES=[my_package.config]