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

PythonServer Side ProgrammingProgrammingdjango

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
raja
Published on 29-Jan-2018 05:29:13
Advertisements