jgorset/django-kronos — Issue #1: Incorrect manage.py location guessing
Author: j4mie
Created: 2012-01-26 18:23:21+00:00
State: open

Hi,

I just found django-kronos and it looks like a great idea. However, it's not currently working with the way my project is laid out.

I'm using a Django 1.4-style layout, and has a settings package (with `settings/common.py` and `settings/development.py` etc) rather than a single file. Kronos tasks end up guessing the location of `manage.py` incorrectly.

@hourly /home/jamie/pulse/env/bin/python /home/jamie/pulse/pulse/settings/manage.py runtask generatestats

I'm happy to work on this and submit a patch if you like, but I'd rather check your preferred approach.

django-supervisor solves this problem by searching for the `manage.py` file in a few places in the filesystem, starting from the location of the settings file and working upwards. It also allows you to override the location by passing a `--projectdir` flag to the management command. This works but seems a bit messy. See: https://github.com/rfk/django-supervisor/blob/master/djsupervisor/config.py#L231

Another option might be to exploit the fact that `installtasks` is itself run with `manage.py` and use something like:

os.path.join(os.getcwd(), sys.argv[0])

Cheers