using only the django ORM (DB access model) and nothing else.

Ian Kelly ian.g.kelly at gmail.com
Tue Jun 21 21:04:07 EDT 2011


On Tue, Jun 21, 2011 at 6:42 PM, News123 <news1234 at free.fr> wrote:
> ###############################################
> If running myapp.py I get following output:
>
> yes this line is executed
> Traceback (most recent call last):
>  File "./myapp.py", line 11, in <module>
>    class Mini(models.Model):
>  File
> "/opt/my_python/lib/python2.6/site-packages/Django-1.3-py2.6.egg/django/db/models/base.py",
> line 52, in __new__
>    kwargs = {"app_label": model_module.__name__.split('.')[-2]}
> IndexError: list index out of range
> (my_python)n1234 at mypc:~/minidjango$
>
>
> So I need at least a little more to make my script work.

There's a bit of magic in the way Django finds things, and I think
you'll still need to keep the basic structure of a Django project --
models should be in a "models.py" file located in an "app" package,
which should be included in the INSTALLED_APPS setting.  You just
won't have any views or urlconfs or templates or admin sites or
anything like that.



More information about the Python-list mailing list