For third-party (jquery) code in my Django project, I've adopted a directory structure for my static files that puts all third-party files in a separate lib
sub-directory. More specifically, this is what my directory tree currently looks like:
myproject/
myproject/
static/
css/
my-own-stylesheet.css
lib/
bobs-stylesheet.css
joes-stylesheet.css
img/
my-own-image.png
lib/
bobs-image.png
joes-image.png
js/
my-own-javascript.js
lib/
bobs-javascript.js
joes-javascript.js
This is meant to accomplish two things: 1. Separating my own assets from third-party assets. 2. Separating css, img, and js files.
Of course, as long as the paths are all correct, this works fine, but is there actually a convention for a location for third-party material in Django projects?
I've also considered
myproject/
myproject/
static/
css/
img/
js/
lib/
bob/
css/
img/
js/
joe/
css/
img/
js/
I wonder if I may be overthinking this, but is there a "best-practice" for this?
The last approach is much better.
If your project is a bit larger, you may consider creating a different directory for each of the apps you have created.
This the directory structure which I generally follow:
myproject/
myproject/
static/
my_app_1
css/
img/
js/
my_app_2
css/
img/
js/
lib/
bob/
what_ever_directory_str_it_has
joe/
css/
img/
js/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With