runmodwsgi errors with newer Django settings
Hi, I've been using the Django management command runmodwsgi for many projects, usually without issue. However, I just started a new project and this time I got an error: "PosixPath object has no attribute 'endswith'." The error is triggered on line 1093 in /server/init.py.
I did some debugging and discovered that the "target" object on that line was a Path object pointing to the directory defined by the STATIC_ROOT setting. Older versions of Django used the os.path.join() method to define that directory, which returns a string, but new versions encourage using the pathlib.Path approach, something like STATIC_ROOT = BASE_DIR / 'collect_static'.
Obviously I can just cast that as a string within the settings file, but I imagine more and more users will have that defined as a Path object. For compatibility you might want to explicitly cast the "target" object as a string so other users don't encounter the same issue.
Thanks for the mod_wsgi package, I've used it extensively for years.
In a test environment can you try a Django project using pathlib for STATIC_ROOT with:
pip install https://github.com/GrahamDumpleton/mod_wsgi/archive/refs/heads/develop.zip
and see if that resolves the issue.
I have made a change but haven't myself tested it yet.
Hold off on that, I stuffed up the changes. :-(
Okay, this time I should have got it right.