I have developed a simple application in Eclipse & Django & Pydev. The application fails while starting and I am given the following error:
*Error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions*
I have tried changing the port number to 8080 in Eclipse by changing the Run Configurations, but this has failed.
How can solve this problem and host my Django application on other port?
If you are willing to do this outside of Eclipse, you can run the Django development server on a different port with
python manage.py runserver PORT_HERE
For example, to use port 8005, you can do
python manage.py runserver 8005
Related
I have a development environment using docker-compose, it has 5 services:
db (postrgresql)
redis
celery
celery-beat
web (a django web app - development is occurring here)
In development, I run the top four in containers with
docker-compose up db redis celery celery-beat
These four containers can connect to each other no problem.
However, while I code with the web app, I need to run it locally so I can get live updates and debug. However, running locally, the web app can't connect with the containers, and I need to map the ports on the containers, e.g:
db:
ports:
- 5432:5432
so that my locally running web app can connect with them.
However, if I then push my code to github, TravisCI fails it with this error:
ERROR: for db Cannot start service db: b'driver failed programming external connectivity on endpoint hackerspace_db_1 (493e7fb9e53f551b3b1eea35f9e2baf5725e9077fc642d8121891cab31b34373): Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use'
ERROR: Encountered errors while bringing up the project.
The command "docker-compose run web sh -c "python src/manage.py test src/"" exited with 1.
TravisCI passes without the port mapping, but I have to develop with port mapping.
How can I get around this so that they both work with the same settings? I'm willing to try different workflows, as I'm new to docker and containers and trying to find my way around.
I've tried:
Developing in a container with Visual Studio Code's Remote - Containers extension, but there doesn't seem to be a way to view the debug log/output
Finding a parameter to add to the docker-compose up ... that would map the ports when I run them, but there doesn't seem to be an option for this.
As pythonanywhere is the one of best place to host python web app. And apps will be hosted as per wsgi.py configurations on it's own server. But what happens when I do something like this on its bash shell?
$ python manage.py runserver 127.0.0.1:9000
Performing system checks...
System check identified no issues (0 silenced).
April 28, 2016 - 15:29:48
Django version 1.9.5, using settings 'MyProject.settings'
Starting development server at http://127.0.0.1:9000/
Quit the server with CONTROL-C.
As you can see I had changed the port to :9000, so is there any way to access this or it's just meaningless as it's serving the app on served server service?
PythonAnywhere dev here. There's no way to access a server you run using manage.py runserver. It will try to bind to a local port, but that port isn't visible from outside the PythonAnywhere cluster.
[edit] Oh, and thank you for the kind words about PythonAnywhere!
I am deploying my Flask application on WebFaction. I am using flask-socketio which has lead me to deploying it with a Custom Websocket App (listening on port). Flask-socketio's instructs me to deploy my app by starting the serving with the call socketio.run(app, port= < port_listening_on >) in my main python script. I have installed eventlet on the server so socketio.run should run the app on the eventlet web server.
I can call python < app >.py and all works great – server runs, can view it at the domain, sockets working, etc. My problems start when I attempt to turn this into a long running process. I've been advised to use supervisor which I have installed and configured on my webapp following these instructions: https://community.webfaction.com/questions/18483/how-do-i-install-and-use-supervisord-to-control-long-running-processes
The problem is once I actually add the command for supervisor to run my app it errors with:
Exited too quickly
My log states the above error as well as:
(exit status 1; not expected)
In my supervisor config file I currently have the following program config:
[program:<prog_name>]
command=/usr/bin/python2.7 /home/<user>/webapps/<app_name>/<app>.py
autostart=true
autorestart=true
I have tried a removing and adding settings but it all leads to the same FATAL error.
So this is what part of my supervisor config looks like, I'm using gunicorn to run my flask app.
Also, I'm logging errors to a file from the supervisor config, so if you do that, it might help you see why it's not starting correctly.
[program:gunicorn]
command=/juzten/venv/bin/gunicorn run:app --preload -p rocket.pid -b 0.0.0.0:5000 --access-logfile "-"
directory=/juzten/app-folder-name
user=juzten
autostart=true
autorestart=unexpected
stdout_logfile=/juzten/gunicorn.log
stderr_logfile=/juzten/gunicorn.log
I apologize for such a beginner question, but I'm stuck. I'm starting learn web development and I want to test out something I am hosting locally using Django runserver command. I would like to test it on my iPhone. According to this question, I just need to point my iPhone to my Windows 7 ip address (which I found through ipconfig). When I try to, I get the error: "Safari could not open the page because the server stopped responding" (a time-out).
Is there anything else that I need to do?
In addition to using the correct IP, your runserver command should listen on 0.0.0.0(all IPs).
runserver 0.0.0.0:8000
Below steps worked for me on MAC OS 10.10.3
python manage.py runserver 0.0.0.0:8000
in terminal window "ipconfig getifaddr en0" returned IP address 10.0.1.22
open browser in Iphone/Ipad "http://10.0.1.22:8000"
You need to use the IP address AND port that the runserver is running on... this is usually :8080 or whatever number that follows the IP it reports when it runs the server.
so if the runserver command reports...
http://127.0.0.1:8000/
then if your IP is 192.168.0.2 use...
http://192.168.0.2:8000/
If for some reason you want to set the port manually, runserver [port] works...
I was given the task of installing jboss-5.1.0.GA on a remote ubuntu 10.4 Lts server. With all those resources out there I was able to run jboss successfully but my problem was that I wasn't able to get auto start on boot work so that jboss would be running on the server.
I followed a couple of tutorials that said me create a separate user called jboss and to copy the jboss_init_Redhat.sh to the /etc/init.d/jboss (jboss home, java path ,jboss user and the binding to 0.0.0.0 is all set) and used /etc/init.d/jboss start
but I can't get to see the Jboss page at the Ip on a browser.,
If i do a ./run.sh -b 0.0.0.0 ==> the server is up ...
Can some body shed some light on this issue????
If you want to run JBoss AS on given interface using jboss_init_redhat.sh script look at these line:
#if JBOSS_HOST specified, use -b to bind jboss services to that address
JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}
You should just define new variable before these line:
JBOSS_HOST="0.0.0.0"
You should also check shutdown command (especially when you run your server on some other address then 127.0.0.1 or 0.0.0.0), it should know how to find your server:
JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown -s jnp://${JBOSS_HOST}:1099"}