I have a website where the user enters information via HTML forms, and PhP is the server side script that handles the forms. However, PhP passes that information to various .py files on the server and the .py files analyze the information and return a result to the PhP which then displays to the user.
I use PyCharm as my local test environment to draft and test the .py files before deploying them to the site. The issue I am having relates to getting the .py files to the server.
Option 1: If I simply upload the .py files from my local computer to my remote Linux server and add the appropriate shebang line to reference the relevant python venv on my server, they never work. Even if I comment out all the content in the file and draft some basic 2 line program just to test it, it doesn't work.
Option 2: If, instead, I create new blank .py files on my server, and then cut and paste the code from the files on my local computer into those blank .py files (and add the relevant shebang to reference my venv), voila, it works. In this case, I am careful to start cutting after the first character and ending before the last character. Then I just fix that after I paste. I do that to try and avoid copying any hidden code/tag that I cannot "see" in the PyCharm IDE.
This makes me think there is some sort of hidden code/tag that PyCharm is embedding that is not apparent in the IDE itself? Is that true? I have read the PyCharm docs on deploying software to a remote server, but the process described seems overly complicated to me, when I just need to upload a file or two to my server. Moreover, there is nothing in the docs that says that you have to follow that process or else your .py files won't work on another machines.
Does anyone know: (a) why you can't simply upload your .py file directly to your Linux server; and (b) if there is a simple option to choose in PyCharm so that I can avoid this problem?