Hi there!

I am in the process of writing a (generalized) service to ease
deployment of Python/Django web applications.  I managed to get the
service up and running (using gunicorn to serve dynamic web request and
nginx to serve static files) but I stumble over one crucial point in the
process.  Django uses it's own, project-specific administration script
(manage.py) as an interface to (admin) users - to collect static files
from the project to a specifies location, to get access to the database,
to get into an interactive (Python) shell, etc.

The most beautiful (in a Django perspective) would be to simply proxy
calls to the manage.py script through a Shepherd action (i.e. invoking
`herd manage django-service-foobar createsuperuser` would call
`manage.py createsuperuser`).  Other options could be to manually write
simplified Shepherd actions for (a subset) of manage.py calls (i.e. the
most important/common ones).

Now I've stumbled on the following two issues and hope for some
guidance:

a) Django needs a python-import statement-like string to select the
correct settings module (this is passed as a command-line argument to
gunicorn, which works just fine, but needs to be set as an env var
(DJANGO_SETTINGS_MODULE) for manage.py),

and

b) some of the manage.py commands are interactive, which would work
great if I found a way to route input/output ports through the Shepherd
action.

And here comes my question:

What is the easiest/best/most Guix way to call the manage.py script and
have input/output ports routed back to stdin/stdout?

Calling (invoke) from a Shepherd action seems to swallow all of the
process' output and fails on processes that expect input - and I have
not figured out how to set an envvar for that called process.

(fork+exec-command) allows setting envvars as an option, but posts the
commands output to a file (/var/log/messages as default) which I could
live with but it's not optimal/user friendly.


Thanks for all helpful input in advance (and probably again when I
managed to solve the issue with your help)

gabber

Reply via email to