Why is a Django project code base heavy on the JS but light on Python?

According to GitHub’s analytics on my freshly created bare-bones Django project repo (just 4 commits as of this writing) suggests the majority of the code foot print is first JavaScript and then CSS:

But Django is written in Python. Can someone comment on why Python is the smallest? Is this because the Python codebase is burried in the depths of the venv whose contents are hidden using .gitignore while JS/CSS are static files for the Django Admin interface that need to be exposed to be customized / modified and be accessible for deployment?

You shouldn’t save the generated static files in your repo. Since you kept track of those js css files on GitHub, GitHub would certainly tell you that you have too much js and css.

1 Like

Hi @lepture. Thank you for your reply. I know enough about Django that collectstatic is for production and unnecessary for building locally. When I push my changes to Heroku, collectstatic runs then and should only run then. I set up this repo some weeks ago and if I recall correctly, I am pretty sure I didn’t run a collectstatic command locally.

Therefore I have two follow up questions:

  1. What command or setting might some novice like me accidentally or unintentionally invoke to cause this undesierable outcome? Serious question. (Based by your tone it seems like I may have violated some rudimentary best practice.)
  2. Is there a simple fix to correct this issue? For example, could I add a few lines to my .gitignore file?

edit: grammar + polish

None. This would only occur as a result of a collectstatic.

Delete the static directory.

1 Like

noted

That did the trick! Thank you. Here is the end result after purging my repo of the static directory showing a more appropriate language footprint: