Friday, October 7, 2011

Re: Easy question (I hope)



On Fri, Oct 7, 2011 at 11:15 AM, Tom Evans <tevans.uk@googlemail.com> wrote:
I do this a lot, and haven't found any problems with doing so. My main
app has no models.py, but has models/{__init__,foo}.py, and it is
still found quite happily by syncdb, south, the admin interface, the
app template loader etc.

Is there a concrete example of a thing that will not work with this structure?

Cheers

Tom


If that's the case then I'm wrong. I guess Django just needs to be able to import 'models' from the app root. I specifically remember reading that 'models.py must exist' whether your app has models or not, or Django won't consider it an 'app.' I took that literally. I didn't consider that it might be checking by attempting to import rather than checking for the existence of a certain filename, and I never tried to do it otherwise.

Example from docs:

Ticket:
https://code.djangoproject.com/ticket/4470 (seems to indicate things don't work properly without a single models.py file)

Shawn

 

--
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