javascript files connecting between apps

I'm working a small Django engineering SAAS website with multiple smaller apps.

Each one of the apps has their own static content, in particular JavaScript files.

Everything is running fine, it's already published, everything great.

When i started to add more apps, i sometimes just need to reuse and tweak some of the existing JavaScript files. Seemed simple enough, but then i started to get some real problems. Just to clarify, all of my problems are JavaScript related.

First i noticed that in pycharm i can call any function of any file of any app in a JavaScript file. It gets very confusing when i just slightly change a function name in a app since the auto-complete function shows me both functions. Since i have a rather long directory structure for my static files, i cannot see the whole path showed in the auto-complete and correctly identify the one i want.

Second, when i want to refactor a function which has the same name on another app i get lots of warnings on different apps that have a function with the same name. I don't want to change those!

Third, pycharm used to warn me when a function wasn't used (it turned grey with a warning notice). It stopped doing that because apparently it's all just one big app.

As my apps grow in number, it's getting harder and harder to code.

I'm i missing something or doing anything wrong?

Working in Linux version.

1 comment
Comment actions Permalink

PyCharm works as expected - it takes all JavaScript files in the project folders and goes through them, adding functions and methods to an internal index used for code completion suggestions/navigation/types resolving. The index is automatically updated whenever existing files are changed or new files are added. So, to avoid confusion because of having multiple duplicate functions in your project, I'd suggest keeping each of your smaller apps as separate PyCharm project.


Please sign in to leave a comment.