Thursday, August 30, 2012

Hard time debugging an strange problem

Hi all,
sorry for the ambiguous subject, but I can't summarize it in a few words.

This is my first message to the list asking for help so I think that is
polite to give a big thanks to those of you that are making developing
with django such a great pleasure. This is a great community.

Said that, I'm working on a management command that adds 'paster create'
like functionality to 'manage.py'. In order to do tests I have created a
simple bash script that:

* cleans the environment (uninstall the app from the virtualenv, removes
the project, app, sqlite database etc.)
* creates a new project (with my command)
* creates a new app (with my command)
* installs the app in develop mode
* creates an empty model (with my command)
* overwrites the model definition with one that has a couple of fields
* runs syncdb
* loads a fixture
* creates a set of views (with my command)

When I run the script, more often than not, I get exceptions in the
'manage.py' command. If I run the individual commands "by hand" I get no
errors. What is driving me mad is that adding a 'sleep 1' between the
commands in the script the exceptions go away (tested running the script
in a while [ $? != 0 ] loop for more than an hour).

The management command does no black magic: it takes context variables
from the command line, adds some variables (like the app object returned
by cache.get_app(), the model we are operating on etc.) and expands a
set of cheetah templates.

The exceptions are of different types:

http://pastebin.com/sW0AAmHn in this run cache.get_app() is unable to
find the 'foobar' app. Of course it is in INSTALLED_APPS.

http://pastebin.com/mRSdkgCb in this run syncdb does not create the
table for the FirstModel model and 'manage.py loaddata' complains.
FirstModel exists, has an applabel="foobar" attribute and is imported
from 'models/__init__.py'.

Here's the script:
http://pastebin.com/08veXtJ6

site-packages:
Cheetah-2.4.4-py2.7-linux-i686.egg/
Django-1.3.3-py2.7.egg/
Django-1.4.1-py2.7.egg/
django_crispy_forms-1.1.4-py2.7.egg/
django_tables2-0.11.0-py2.7.egg/
dja-skel.egg-link
easy-install.pth
foobar.egg-link
ipython-0.13-py2.7.egg/
Markdown-2.2.0-py2.7.egg
pep8-1.3.3-py2.7.egg/
pip-1.0.2-py2.7.egg/
Pymacs/
setuptools-0.6c11-py2.7.egg
setuptools.pth

python version:
Python 2.7 (r27:82500, Jul 17 2010, 02:48:50)
[GCC 4.4.3] on linux2

Django 1.4.1


I don't care for having to wait a few seconds in order to get a clean
environment but I'm very curious about what the problem may be. Any idea?



Regards,
Alexis

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment