1

I installed Anaconda with Python, added some more packages and tried to run Django development python manage.py runserver 0.0.0.0. It's running fine but I can't access it remotely from some reason. My server on other port is working fine and firewalls are all set. I found others had this problem and they simply run it as superuser sudo python manage.py runserver 0.0.0.0.

My problem is that when running as superuser, it will use different Python (or at least that's what it looks like). It is same 2.7.12 version (but no Anaconda suffix) and there are no required packages, so I can't run server.

I'm not really experienced with Linux. I tried to remove Python from root and passing env variables, but that didn't help. How can I run python as superuser and use Python with packages from my user.

JoKr
  • 4,976
  • 8
  • 27
  • 39
  • As far as I understand, Anaconda is installed in your home (`~/anaconda`) by default. root is not allowed to read your home directory. Thus, you cannot easily use your Anaconda installation as root user. – jotasi Nov 10 '16 at 14:44
  • It is installed at home. Should I reinstall it, and at which location? – JoKr Nov 10 '16 at 14:47
  • I never actually used Anaconda, so I don't feel qualified to give a complete answer about its proper usage. Generally, root is not allowed to access your home, so if you want to be able to run Anaconda as root, you should probably install it in a directory, everyone can access, as for example `/opt/` or `/usr/local/bin` (see: http://stackoverflow.com/a/27364203/6614295) – jotasi Nov 10 '16 at 14:51
  • I think you should use this http://stackoverflow.com/documentation/django/200/getting-started-with-django/3203/virtual-environment – Alex Nov 10 '16 at 15:30
  • @Ixer While this is probably a good idea, will this fix the problem of differing python environments as root? He would have to have the environment in place accessible to root anyway, isn't it? – jotasi Nov 10 '16 at 15:34
  • same as http://stackoverflow.com/questions/28760300/change-default-python-to-anacondas-python-in-root ? – Alex Nov 10 '16 at 15:39
  • Yea, I installed it in `/opt/anaconda2/` and it all works now. Yes, there are same questions, but I couldn't get the right query when i was searching. Anyway, thanks @jotasi for help. You can write answer if you want me to accept it. – JoKr Nov 10 '16 at 15:46
  • Didn't get to see that you have already solved your problem before I post my answer... – pyan Nov 10 '16 at 16:11

1 Answers1

1

Try sudo running your local python, like

sudo /home/YourAnaconda_bin/python manage.py runserver 0.0.0.0
pyan
  • 3,577
  • 4
  • 23
  • 36