What's the best place for python classes in a Django project?

You are free to put it where you want.

example:

project
  myapp 
     views.py
     models.py
     feeds.py

Then you can import you're feeds module by using import.

from project.myapp.feeds import *

Making directory is better when you deal with a lot of file. For example:

project
    myapp
      models.py
      views.py
      extras
        feeds.py
        sitemaps.py

I suggest you to read this: Python Modules: Packages


For feed-related classes, it's conventional to place them in a module called feeds in the appropriate application module. For example, if you have a blog with an RSS feed, your project structure would look like this:

project/
    blog/
        __init__.py
        feeds.py
        models.py
        views.py

In general, for other non-model classes, you can put them anywhere you want (as noted by Andrea Di Persio). Typically you place them as a module in the appropriate application package. For general-use classes, I usually create a package called lib that contains general classes and functions, like so:

project/
    blog/
        __init__.py
        feeds.py
        models.py
        other_stuff.py
        views.py
    lib/
        __init__.py
        things.py

Tags:

Django