问题
I'm in the directory /backbone/
which has a main.js
file within scripts. I run python -m SimpleHTTPServer
from the backbone
directory and display it in the browser and the console reads the error $ is not defined
and references a completely different main.js
file from something I was working on days ago with a local python server.
I am new to this and don't have an idea what's going on. Would love some suggestions if you have time.
回答1:
Only one process can listen on a port; you cannot have two SimpleHTTPServer processes listening on the same port. You can however leave an old server process up and then disregard failed startup of the new server process or error message about automatic port conflict resolution.
To debug this process, use netstat
( lsof
in OSX, since BSD netstat is lame ) to find the process listening on the port and then 'ps -fww' to list data about that process. You can also take a look at /proc/$pid
( linux ) to get a process ID's current working directories. lsof
can also help track down files the process has open in linux OR BSD/OSX if you're unsure which files it's serving.
Hope it helps!
来源:https://stackoverflow.com/questions/22521912/local-server-giving-wrong-files-is-it-possible-im-running-2-python-servers