PyCharm and Django Shell Networking - django

(My Python is installed via Homebrew and correctly refered to by the preferences as my project interpreter)
I have a problem with PyCharms Django Shell. If I start the django shell, it runs the command (ports are changing):
/usr/local/Cellar/python/2.7.3/bin/python2.7 -u /Applications/PyCharm.app/helpers/pydev/pydevconsole.py 52135 52136
Now, this wont work, it justs states "PyDev Console: starting" and after a while, it stops.
BUT when I'm disabling my Wifi, it works! Now, what could this be?
(I'm running the latest Mountain Lion OSX, firewall disabled, PyCharm 2.5.2, Django 1.4)

It looks like the problem is related to Mac OS DNS resolution specifics. While trying to resolve this problem with #ruffy, what fixed it was changing the LAN DNS server to Google (8.8.8.8).
I've logged this issue in PyCharm tracker so that we can provide a workaround for it in the future updates.
Related topics:
Mac OSX Lion DNS lookup order
Mac OS X Lion, /etc/hosts Bugs, and DNS Resolution

I had this problem too, but this was caused because my hostname was 'localhost'.
Once I changed my hostname to something else (from the sharing section in Preferences) - it worked like a (Py)Charm.
The problem was somewhere in pydev-console, and I don't know why my solution worked - I only guessed it was the problem because originally the console worked, and then it didn't and the only thing had changed was my hostname (due to some fiddling at work)

start terminal
nano /Applications/PyCharm.app/helpers/pydev/pydevconsole.py
after line 160 add:
160 def process_exec_queue(interpreter):
+ 161 print 'here'
162 while 1:
163 # etcetera
save and run shell again, does it show the print message? If it does, move it into the while loop and repeat the process until you've narrowed down the problem

Related

Get err_connection_refused accessing django running on wsl2 from Windows but can curl from Windows terminal

I got the err_connection_refused when trying to accessing django running on wsl2 (http://localhost:8000) from Windows but when I use curl http://localhost:8000 from Windows terminal bash, it's working fine. I have tried to add a new firewall inbound rule for port 8000 but it's still not working. Is there anything else I need to take care of.
Thanks a lot
Seems like a forwarding problem. WSL2's interface is NAT'd, whereas WSL1 was bridged by default. WSL seems to do some "auto-forwarding" of ports, but only on localhost. However, sometimes this auto-forwarding mechanism seems to "break down". The main culprit seems to be hibernation or Windows Fast Startup (which are both closely-related features).
Does the problem resolve if you do a wsl --shutdown and then restart the WSL2 session? If so, try disabling Windows' Fast Startup. I already had Fast Startup disabled due to a different (non-WSL issue) on my system, so that could be related to why I am not able to reproduce.
Along the same lines, do you Hibernate instead of powering off? In that case, a wsl --shutdown might resolve as well.
For future readers, note that the above two points seem to resolve the issue for most people who have upvoted and responded in the comments. However, if that does not work for you, the following were my original "additional suggestions":
For some additional ideas, see this github issue. There are some suggestions on services that might be needed. (Side question - Are you running Windows Home or Professional?)
Is there any chance that your Windows hosts file (e.g. c:\windows\system32\drivers\etc\hosts) points localhost to an IP other than 127.0.0.1? If I attempt to access via my local Windows IP address, rather than 127.0.0.1 or localhost, I get an ERR_CONNECTION_REFUSED as well.
Since you were looking at the firewall rules, maybe look at a forwarding rule instead of just an inbound allow?
If all else fails, try exporting/backing up the WSL2 session (see wsl --export), then import it in as a new WSL1 session. See if it works there.
On my WSL2/Ubuntu 20.04 system, I attempted to reproduce (but haven't been able to yet) with the following steps:
mkdir -p ~/src/dj-test
cd ~/src/dj-test
python3 -m venv dj
source dj/bin/activate
pip install Django
django-admin startproject config .
python manage.py runserver
(although I used activate.fish since I'm running the fish shell)
From Vivaldi web browser in Windows, accessed localhost:8000, which returned "The install worked successfully! Congratulations! ..."
curl under Powershell Core worked as well.

Localhost Coldfusion install showing cfquery parameters on page (Not speaking with ODBC)

Goal:
Run cfquery of remote server on local Coldfusion install.
Problem/Symptoms:
The cfquery parameters are printing onto the screen, instead of running query on remote.Example of cfquery parameter printout on screen
Facts:
Running Mac OS X Mojave (10.14.3).
Coldfusion is installed. I can access the CF Admin panel at http://localhost:8500/CFIDE/administrator/index.cfm
Data Source is installed in Coldfusion Admin and status is "OK"
Using Mamp Pro 5.3. It's running -- can start and stop Apache.
Apache is running on port 80
Updated ODBC Actual SQL Server drivers (Version 4.2.0 from ActualTech). Tested connection to server with driver and it is working.
Remote database is using port 1433
I'm sure there are more questions to answer, but hopefully that's a decent start. What am I doing wrong?
Update: 3/17/2019
Feeling stuck here. I've uninstalled and reinstalled CF2018 and MAMP Pro. I've used the wsconfig applet for Adobe Coldfusion (ACF) as described by Brian Lang and I've also tried the manual approach as described by Adobe.
Update: 4/19/2019
I may have figured this out, now that there is a release of Mac OS 10.14.4. Going to test it on another computer to confirm that the process works and that I have all the steps documented, then will share answers.
The solution to this problem had to do with a conflict with Mac OS X and Coldfusion/Apache. Because Mac OS X 10.14.4 fixed the "mod_jk" file that was conflicting with Apache, Coldfusion 2018 can now run on Mac OS X.
In order to solve the problem, I needed to:
upgrade Mac OS X to 10.14.4
stop all other servers
install Coldfusion 2018
set up Coldfusion Apache Connector
set up local virtual host
I confirmed that it worked on another computer, and have documented detailed instructions in this post: https://www.steckinsights.com/configuring-coldfusion-2018-with-apache-on-mac-os-x-mojave/
Fair warning: I think that the mod_jk issue in Mac OS 10.14.3 and prior was the issue, but there were so many different aspects I tested in the process, that there may be unique issues related to your particular computer's configuration. I hope hope this helps anyone out there having issues.

Appcelerator Titanium build error about log-server-port masks the real error

This is relatively minor, and I wasn't able to find any other record of this issue, but it cost me several stressful hours. I'm considering opening an Appcelerator Jira ticket about this bug, so any feed back is welcome before I do so. Questions: Are there any other workarounds besides what I wrote below? What are some better ways to log the actual error?
Environment
Titanium SDK: 7.0.2.GA
Javascript Engine: V8
Platform & version: iOS 11.2
Device Details: iOS simulator (iPhone 7+)
Host Operating System: OS X 10.13 64 bit
Node Version: 7.10.0
Titanium CLI: 5.0.14
Npm Version: 4.2.0
Description
When building an iOS app and there is an issue connecting to the iOS log-server, it always output "Another process is currently bound to port xxxxx" even if there is another server connection issue such as the port not existing.
Workaround
Figure out the real issue by logging the actual error within the sdk itself (at ~/Library/Application Support/Titanium/mobilesdk/osx/7.0.2.GA/iphone/cli/commands/_build.js in the determineLogServerPort function).
Steps to Reproduce
Create a different type of error with the server. For example, my /etc/hosts file did not have an entry for 127.0.0.1 localhost, so the actual node error was 'ENOTFOUND'.
Create a new titanium app with appc ti new.
Build with appc ti build -p ios
Actual Result
Build errors out with following text:
[ERROR] Another process is currently bound to port 27973
[ERROR] Set a unique <log-server-port> between 1024 and 65535 in the <ios> section of the tiapp.xml
Expected Result
More detailed error. I.E. Something like:
Failed to create/connect to log server port with error "[error given by node net package]".
Followed by suggested solution. For example if the node error was EADDRINUSE, then you could still use the existing error message. But if it's another error, log accordingly so the user has the best information for solving the issue.
Close current emulator running and try again
when emulator was opened by xcode, I got such issue
Please make sure you are executing the app with same App name and ID.
If there is a change, please delete the app from device and retake the build.
I opened the ticket with appcelerator here: https://jira.appcelerator.org/browse/TIMOB-25872
They have just marked it as closed so it will hopefully be included in the next sdk version.
The solution for me was what was mentioned as a solution in the JIRA ticket on appcelerator https://jira.appcelerator.org/browse/TIMOB-25872.
I had recently moved to a new Mac and migrated everything, it created a copy of my host file renaming it but didn't update main one so it had no reference to the localhost in there. Once this was fixed it was building no problem again.
Below is what is in the host file.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Hope that helps someone, didn't see the answer on JIRA at first glance.

Webserver not working on OSX Mavericks

I was running a webserver and also Coldfusion just fine until I upgraded to Mountain Lion, then it stopped working. I got it working again by turning everything back on that the upgrade disabled, but now I have upgraded to Mavericks nothing is working. I have followed all the steps in various web articles but it won't work. PHP is enabled, everything that was enabled before is set up, including virtual hosts, and all the folders are in the same place.
I get the error: Firefox can't establish a connection to the server at 127.0.0.1. [or localhost, or any of my virtual hosts]
I've gone over everything time after time and I can't figure out why it won't work. I have started, stopped, restarted the webserver numerous times, it is set to start on bootup too. I couldn't even complete the Coldfusion install because I couldn't load the administrator in a browser.
What could the problem be? Where should I look?
This is not a complete answer, but this should help get things started
Try using the command line start. It will probably be complaining about Java 7 not being installed. I recently needed to install Java 7 JDK (not JRE to get things running)
I know to get the rest of it running, I need to point ColdFusion at the proper JVM. You can find the JVM settings at /Applications/ColdFusion10/cfusion/bin/jvm.xml. You should have some setting like
# VM configuration
#
# Where to find JVM, if {java.home}/jre exists then that JVM is used
# if not then it must be the path to the JRE itself
java.home=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
application.home=/Applications/ColdFusion10/cfusion
When you install Java 7, the JRE is at
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
Backup, and edit the jvm.config file to
#
# VM configuration
#
# Where to find JVM, if {java.home}/jre exists then that JVM is used
# if not then it must be the path to the JRE itself
java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
# java.home=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
application.home=/Applications/ColdFusion10/cfusion
If all goes well, you should be able to start ColdFusion
Some additional help
Installing Java on OS X 10.9 (Mavericks)
When you install Java 7
Just saw this thread. ColdFusion 10 is now supported on OS X 10.9 Maverick with the release of CF10 Update 13.
This should work for you now.

Local sites not displaying in VirtualBox when using Django's local development server?

I develop web applications using Django on Mac OSX 10.6. I use Django's built in local development server which I run on my computer's IP (such as: http://192.168.0.11:8001/). I test my applications in Firefox, Safari and Chrome and all display fine. I use Sun's VirtualBox with 3 different instances of Windows XP that have IE6, IE7 and IE8 on them.
For whatever reason, these sometimes just don't display the Django sites. They come up with 'The page cannot be displayed'. Eight times out of ten, they display fine and function normally but for no reason at all they won't display. Sometimes restarting Django's local development server from the Terminal will fix the problem, sometimes it won't.
Is there some sort of VirtualBox settings or Django settings that I need to set to ensure smooth operation of this? Am I overlooking something? Has anyone else had these problems?
By default the dev server binds to localhost. to run it on all interfaces use ./manage.py runserver 0.0.0.0:8000
I found the best way to do this is using the normal localhost:8000 or localhost:8001 (any port you need, especially if running multiple Django projects at the same time) in the Mac Terminal.
Then in VirtualBox with Windows, using the ipconfig command in the Command Prompt to find out the IP settings. Grab the Default Gateway (mine was 10.0.2.2 for example) then, in the browser, use this as the address to get to your Django project along with the original port setting that was set in the terminal. So in this case: http://10.0.2.2:8000/
I've been running it like this now for almost a week and it seems to of stopped the problems I was getting before totally. I couldn't really tell you why though!