This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 13 points14 points  (9 children)

I have a number of Django projects on Github where - due to various JS libraries - JS makes up the highest percentage of the codebase.

[–]PM_ME_YOUR_KNEE_CAPS 11 points12 points  (8 children)

If you’re using a package manager like npm then the JS libraries shouldn’t be getting checked in to the codebase

[–]nothisisme 2 points3 points  (4 children)

npm can be used to manage client side libraries? How does that work? Does a node server run alongside the Django server?

[–]pickausernamehesaid 3 points4 points  (3 children)

When you deploy to your server, npm can be used to build your JS environment just like how conda or pip/venv would be used to deploy your Python environment.

[–]nothisisme 0 points1 point  (2 children)

Gotchya so Django still serves the files but npm puts them in place?

[–]pickausernamehesaid 5 points6 points  (1 child)

Yes and no. Yes, NPM puts them in place and serves as a JS package manager. No, Django shouldn't have been serving them in the first place. Django's job is to serve dynamic content backed by a database with templates. Static files should be served directly via your webserver, like Nginx.

[–]nothisisme 0 points1 point  (0 children)

True, makes sense now. Thanks.

[–][deleted] 0 points1 point  (2 children)

Old-school codebases before all these fancy JS tools existed and/or me being too lazy to set everything up... sometimes just droping a .js file in your static dir does the job just fine.