Normally using sudo will request the user a password after executing it but sometimes we might need to run a command with sudo from a script(bash script) or from a program. To auto enter a password for a script that will execute a sudo command you will need to do it like this in your script:
echo [password] | sudo -S echo "Sudo with auto enter of password"
Just replace the “[password]” with your actual password. Notice that we have “-S” as the option we pass for the sudo command. This option enables sudo to read the password from stdin where we have echoed our password.
Just an opinion but if you find yourself needing to auto enter a password in sudo command then maybe you should consider running it as a root user instead.
By default Django development server will only be accessible through the local machine(127.0.0.1). If you want to access the server remotely then you need to run the the development server with your IP as an argument:
python manage.py runserver [your-ip-here]:8000
Change the “[your-ip-here]” to your actual IP. If you IP address is 184.108.40.206 then you will need to run the server using this:
python manage.py runserver 220.127.116.11:8000
If you have multiple network configured or you want the server to be automatically available on what your IP now currently is. Then enter 0.0.0.0 as your IP, like this:
python manage.py runserver 0.0.0.0:8000
This will bind the development server of Django on all available network/IP address. Then you will the see same message when you use just use python manage.py runserver upon successfully creating the server but instead of http://127.0.0.1:8000/ you will see a http://0.0.0.0:8000/, then you will now be able to access your server remotely.
0 errors found
February 01, 2014 - 10:13:18
Django version 1.5.1, using settings mysite.settings
Development server is running at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Warning: This server is only meant for development use so you must not use this as a production solution. This is also discouraged by Django team.