Forums

Django runserver on pythonanywhere?

Hi,

Can I run Django's runserver on Pythonanywhere somehow?

From Bash console, I started it with python manage.py runserver 0.0.0.0:8001 But I cannot access it at http://myusername.pythonanywhere.com:8001

My intention is to use PythonAnywhere to serve me as development server as well as production sever.

I'd like to use pdb to debug view functions interactively after it was called for POST. I am using logging to get message displayed in error log. But I miss interactivity of pdb. "manage.py shell" gives me interactivity for debugging models but not views with request context.

Googling around, it looks it is difficult to get console access for WSGI app... https://code.google.com/p/modwsgi/wiki/DebuggingTechniques https://github.com/GrahamDumpleton/wsgi-shell

So I would like to use django's runserver.

(Would SSH port forwarding make this work?)

SSH port forwarding might work, yes. Be aware that the ports on PythonAnywhere are effectively public, so anyone can snoop on what you're doing. But, assuming that doesn't matter, then you could try using SSH port forwarding. Something like this:

ssh -L 8002:localhost:8001  aerialist@ssh.pythonanywhere.com

Would set up port 8002 on your machine to be hooked up to port 8001 on PA. I think.

SSH port forwarding works! Thank you, harry!

what 's the password in here

your SSH password is the same as your normal account password, but SSH is a paid feature I'm afraid...