Tracking two static file directories or just one?

Django git repos should only track one of two static file directories. The first tracked directory is used by the developer to make changes to CSS and Javascript files. The second directory is just a reflection and assembled when collect static is used. The second static directory should be hidden in .gitignore. Is this all correct?

Is there any scenario where it would make sense to track both static file directories? Or would that be a serious architectural flaw if my Django project needed to track both static file directories to function?

In every Django deployment that I’ve done, the target for collectstatic is completely outside the project directories. We use nginx to serve the static files, and so the directories used by the Django apps are under a directory within nginx’s control.
As a result of this, they aren’t (can’t) be tracked or controlled by git.

Yes, I would offer the opinion that if you “needed” to track your collectstatic target directory within git, you’re probably doing something wrong.

Note: You may, or almost certainly have, multiple static directories within your project that gets collected by collectstatic. The base ‘static’ directory in your project is not the only source of static files. Modules like the Admin module also have static files that get collected for deployment.

1 Like

Thank you for your answers, @KenWhitesell :slightly_smiling_face: