tags:

views:

68

answers:

1

I am working on a Django app and I have a class which reads the contents of a file and returns a Django model. My question is where do I store this class in the file system? All this does is reads the file, populates a Django model and returns it.

Thanks

+2  A: 

There is nothing special about a Django application: it's just a Python package. Technically you can put the class anywhere you can import.

With that being said, it's best to keep related code bundled together. It sounds like a good place for this particular class is in the file that declares the Model it returns.

On the other hand it might be logical to throw it into the application's __init__.py file.

You could also make a utils, etc, admin, scripts . . . folder/package to put utility classes and scripts if it's meant to be used for administration and site maintenance.

In the end it's more about how you want to organize your project, but technically it can live just about anywhere.

digitaldreamer
Thanks, this definitely helps.
iHeartDucks