Hi,

I'm using django 1.3

I tried to create a tiny django app with management functions and to create an executable from it.

When trying to call syncdb with following code.

import django.core.management as management
management.call_command('syncdb')

However the way, that django tries to locate management functions seems to be a little unfortunate.

When trying to call 'syncdb' tries to locate the file syncdb.py in all potential management directories.

With py2exe the directory does not exist, as the library is a zip file
syncdb is precompiled, thus only syncdb.pyc (or syncdb.pyo depending on the py2exe settings)

Therefore django reports, that syncdb cannot be found.

The colprit seems to be:
- django/core/__init__.py: find_commands() which searches only for .py files

With py2exe only .pyc (or .pyo) files exist and
all modules are in a zip file and not in a directory tree.



So I decided to call the syncdb function explicitely via


import django.core.management.commands.syncdb as syncdb
syncdb.Command().handle()

Just to find out, that syncdb tries to call the management function loaddata, which again cannot be found.


So my question:

Did anybody else encounter this issue and if yes how did you work around it?

Potential (so far untried solutions), taht I see are

import django.core.management
and pre-populate  _commands manually

monkeypatch django.core.management with a slightly smarter algorithm.

Thanks in advance for any info.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to