Computer >> Computer tutorials >  >> Programming >> Python

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


You can put said class where you want.

example

project
  foo
     bar.py
     baz.py
     qux.py

Then you can import your qux.py module by using import.

from project.foo.qux import *

Making directory is better when you are dealing with a large number of files. For example −

project
    foo
       bar.py
       baz.py
       extras
         qux.py
         quux.py