13๐
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
4๐
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
- Django eager loading in many to many
- Unknown column '' in 'field list'. Django
- Check if a function has a decorator
- CORS django 'Access-Control-Allow-Origin'
- How can I send signals from within Django migrations?
0๐
Models.py
is the best place for your class, because models have access to data stored in the database.