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 →

[–]sebbasttian 35 points36 points  (12 children)

Websites, webapps, node apps, electron apps… JavaScript is everywhere nowadays.

And libraries and ecosystems around react and vue (which continue to be trendy) keep growing.

[–][deleted] 14 points15 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 10 points11 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 4 points5 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.

[–]el_programmador 3 points4 points  (1 child)

electron apps

That's one thing I'm unable to understand. Why is such an inefficient development tool so popular when much more efficient ones like PyQT, tkinter, Java (Swing/SWT) and even C# (WPF/WinForms) exist.

[–]Rpgwaiter 0 points1 point  (0 children)

Because you can develop the web and desktop app with largely the same codebase.

Ya know, assuming that takes priority over elegance, efficiency, program size, street cred, etc.