#25602 closed Bug (invalid)
Django breaks sphinx
| Reported by: | Aristotelis Mikropoulos | Owned by: | nobody |
|---|---|---|---|
| Component: | Uncategorized | Version: | 1.8 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I try to use sphinx-apidoc on my Django app, but when I run "make html" I get an error. I have tried everything I found as solutions, but with no luck.
conf.py https://bpaste.net/show/c10e9d3877bf
traceback https://bpaste.net/show/d2451bcd91fd
the app is this one https://github.com/amikrop/django-uaccounts/ and I put the docs directory right in the root
Change History (5)
comment:1 by , 10 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 10 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:3 by , 10 years ago
django.setup() did not help no matter where I put it in conf.py
I would appreciate further investigation/help.
django.setup() after settings.configure(): https://dpaste.de/aekd
django.setup() before settings.configure(): https://bpaste.net/show/730b6345ee5e
comment:4 by , 10 years ago
After all I managed to do it by monkeypatching FileDescriptor's
__get__
in conf.py. First, I needed to be in a Django project, not enough to just be in a "projectless" app. Second, it needed manual setting of environment variable DJANGO_SETTINGS_MODULE, which settings.configure() couldn't do. And third it needed the monkeypatch. These were the lines needed in conf.py:
sys.path.insert(0, os.path.abspath('..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
import django
django.setup()
from django.db.models.fields.files import FileDescriptor
FileDescriptor.__get__ = lambda self, *args, **kwargs: self
I mentioned it for future reference and it would be nice if it could all be documented together.
comment:5 by , 10 years ago
I think the issue with FileDescriptor will be fixed in Django 1.10 (#21042).
I'd guess you need to call
django.setup()somewhere as described in the first question in the Applications Troubleshooting.Please see TicketClosingReasons/UseSupportChannels if you need further help.