Syntax error when trying to run debug configuration for remote interpretor from PyCharm - django

I'm setting up a Google App Engine Django project to run in a Vagrant environment for easy setup/teardown of the system and am using PyCharm as the IDE for it all. I'm able to successfully get the server to run using PyCharm on the remote machine, but if I try to use the remote debugger to start a debug session, PyCharm gives me a nondescript error:
Error running webapp: Can't run remote python interpreter: Couldn't obtain remote socket from output , stderr File "", line 1
import
^
SyntaxError: invalid syntax
I'll try to include as much info about the setup as I can:
Windows 10 host machine, Ubuntu 14.04 guest
Python is version 2.7.10
/home/vagrant/www/shell/python-su.sh setup as python interpreter. Just passing arguments to sudo /usr/bin/python $# to make it work in vagrant/GAE
GAE Directory in PyCharm is set to /home/vagrant/google_appengine/ to make it work on the remote machine
Here's a screenshot of my PyCharm Configuration Settings for launching debug client:
All of this matches what I do for the run configuration and that works fine. It's only the debug configuration throwing this error.

From the help documentation for PyCharm, I found this article detailing how to turn on more logging to the PyCharm log file. Add this to the log.xml file located in the /bin/ directory of the PyCharm Program Files directory:
<category name="#com.jetbrains.plugins.webDeployment">
<priority value="DEBUG"/>
</category>
Looking at the log file showed what command it was trying to run, which I was able to run by SSH-ing into the machine to run it myself. From there, I was able to figure it it was coming from my sudo python file. I had to wrap the $# in quotes to get it to work properly. The run was working because the arguments were simple enough that it didn't matter that it wasn't quoted. The final python sudo shell file looks like this:
sudo /usr/bin/python "$#"

Related

running 'heroku login' won't create _netrc file

I am using on a 64-bit system running Windows 11 with Python 3.7 installed and working in a virtual environment where I have installed Django 3.2. I am trying to deploy my project using Heroku.
I have tried adding heroku cli 64-bit Windows version to various paths. I have set the env variable HOME with a value of C:/Users/<username>/_netrc. I have cleaned up the path on each installation so there is only the current path.
When I run heroku login from within my project, I get the following error:
EPERM: operation not permitted, open C:/Users/<username>/_netrc
Any help here is appreciated
I have set the env variable HOME with a value of C:/Users/<username>/_netrc
HOME should be a directory. Heroku will take care of the _netrc part.
Try setting it to C:/Users/<username>/ instead.
delete the existing file in path C:/User//_netrc
used git bash or terminal for it as i was unable to find the _netrc file in file Explorer.
after deleting It run the below command in project folder.
heroku git:remote -a <heroku_app_name>
by running the above command it will create a new _netrc file

Remote gdb with Eclipse Oxygen 3a

I've read several guides/stackoverflows but not found a similar situation/solution.
I have my remote ssh working (can browse files).
I don't get why I need a local Windows application (although I have a compiled .exe it's not the version I want to debug which is only on the Linux server).
When I try and launch a remote debug session it immediately fails with
Exception occurred during launch
Reason:
Error during file upload.
and below in the details
Could not write file: <my windows exe path>
Permission denied
...
The aforementioned file is writable and in any event I also started eclipse as administrator just in case.
In any event the .exe is irrelevant. I just want to debug code remotely.
(I know all about gdbserver...happy to manually kick that off if need be....don't think I'm there yet though)
Below is the options page I'm presented with:
Had the same experience on TI Code Composer Studio Version: 9.3.0.00012.
This seems to happen while uploading the cross compiled binary from host to target. If you set the check box "Skip download to target path" the error should disappear.
I propose to workaround the upload.
Setup a web server on the host, the line python.exe -m http.server --directory \source\hello\Debug\ would be sufficient
Run wget on the target, see screenshot

PyCharm Django previous project`s server still runs after opening and running another project

Steps to reproduce the problem:
Open 1st project.
py manage.py runserver
(now I can see my Project_1 website in browser by address http://127.0.0.1:8000/).
CLOSE project in PyCharm and open another project.
Execute py manage.py runserver after opening 2nd project.
Refresh tab in browser... And WTF? I still see my 1st project page while I am already close it, opened another project and even RUNSERVER on 2th project.
I MUST see on tab http://127.0.0.1:8000/ new project webpage after runserver, but it does not work.
Is it PyCharm bug or something else? I am using PyCharm Pro with the latest updates.
On Windows:
Open CMD
Run command netstat -o to get list of running processes with open ports.
Find the development server process by its address (for example http://127.0.0.1:8000/). You need to remember PID number.
Run command Taskkill /PID #### /F(for example Taskkill /PID 26356 /F) to kill the process. Where #### is your running development server PID number.
Enjoy! Now the server is not running anymore after the PyCharm was closed.
On linux:
django development server, how to stop it when it run in background

PyCharm can't connect to interpreter in docker

I use PyCharm 2016.1.4 on a Mac. I followed the instructions on this page, and I want to connect PyCharm to a Django project which runs in docker via docker-compose.
I added the configuration file and service name but when I press OK I get this error:
Can you help me solve this problem?

Installing PostGIS on Windows

I've installed PostgreSQL and PostGIS, and now I'm trying to follow these instructions:
http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#spatialdb-template
But I keep getting the following error, both in the command prompt and in Cygwin:
C:\Users\Home>createdb -E UTF8 template_postgis
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
And I know PostgreSQL is running, because I'm using it right now!
Installing open source applications can sometimes be so frustrating...
I'll be very grateful for your help!
Are you by any chance using cygwin here? Particuarly, is the system picking up createdb from a cygwin binary?
If your server is cygwin, try removing it and replace it with the Windows version.
If your server is the Windows version, but you have createdb from a cygwin install in the PATH, try removing cygwin from your PATH to make sure you pick up the Windows version of createdb.