Hi Scott,

Yes, generally single-app relevant utility code should be included as 
additional modules within that app. Some examples:
my_app ├── __init__.py ├── apps.py ├── models.py ├── urls.py ├── utils.py # 
include utility code as another module └── views.py 
​
my_app ├── __init__.py ├── apps.py ├── models.py ├── urls.py ├── utils # 
break out more complicated utility code into a package │ ├── __init__.py │ 
├── utility1.py │ └── utility2.py └── views.py 
​

If the utility grows and becomes useful across a range of apps and 
deployments you might then consider breaking it out into its own python 
package that could be installable independently of the original Django app.

 Brian


On Saturday, March 11, 2023 at 4:04:10 PM UTC-8 Scott McKissock wrote:

> Django/Python noob question. What is the convention for including utility 
> packages/modules within a django app?
>
> I have a bit of code that will only be used in a single django app, and 
> I'd like to write tests for it and use it within the app. Should I just put 
> it in a directory/package in the root of the app?     
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/de0776eb-6963-4dc8-abe8-05ab0c9cad5fn%40googlegroups.com.

Reply via email to