On a django site I am getting socket cluster error - python

Not Found: /socketcluster/
[06/Aug/2020 21:45:44] "GET /socketcluster/ HTTP/1.1" 404 3181
this happens every 61 secounds while I am running the django webserver, using "python3 manage.py runserver". I am very new to web development and have no clue what this is or means, any help is appreciated.
P.S. Do I need a db to handle requests for the web server

This is happening for me as well. I'm still looking into the issue and I'll update this when I have a better answer, but I've found a temporary solution.
If you start the local Django server on a different port than the default 8000, the pesky requests go away:
python manage.py runserver 8001
Maybe some other process currently running thinks there's a socketcluster server active on post 8000, or something hidden in my codebase.

I had this problem and it turned out to be a recently installed chrome extension.

Related

Django site cant be reached

I run the server in c9 (django workspace). There were no errors and it said
Starting development server at http://127.0.0.1:8000//.
However, when i open this site it says
This site can’t be reached
127.0.0.1 refused to connect.
Can anyone help me fix this issue
127.0.0.1 is your local computer, not the c9 instance. The docs refer to a unique URL for each app, like: http://<workspacename>-<username>.c9users.io:8081
So, try using runserver like this: python manage.py runserver $IP:$PORT
You can then look in your browser tab for the server address that you can see your app running on, which will be similar to the one above. You'll use that when testing instead of localhost or 127.0.0.1.
Check out the Django guide on their site for more details.
In the documentation says that you use a URL they give to you (not localhost) to access the server
Use the Share button on the top to figure out the URLs of running Application and the Preview.
See https://docs.c9.io/docs/run-an-application#section--pre-view-your-application

Django Tutorial: Runserver not working

I am starting to dabble with Django, and am having issues with the tutorial (https://docs.djangoproject.com/en/1.7/intro/tutorial01/)
I have successfully installed the framework. After running the migrate command, and starting the server with this command:
python manage.py runserver
Powershell outputs:
System check identified no issues (0 silenced).
November 27, 2014 - 16:32:54
Django version 1.7.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
So everything seems to be working fine. The tutorial tells me that:
Now that the server’s running, visit http://127.0.0.1:8000/ with your
Web browser. You’ll see a “Welcome to Django” page, in pleasant,
light-blue pastel. It worked!
But when I go to that link, I get the following message show up on my browser:
ERROR
The requested URL could not be retrieved
While trying to retrieve the URL: http://127.0.0.1:8000/
The following error was encountered:
Connection to 127.0.0.1 Failed The system returned:
(111) Connection refused The remote host or network may be down. Please try the request again.
Your cache administrator is root.
I am new to web development so I apologize for asking a rookie mistake, I just can't seem to find this issue with the django tutorial online, so I must be pulling a seriously rookie move!
Thanks in advance!
Maybe the problem is proxy? Look for this.

How can I change this Django Application

I was tasked with making some changes to a Django application. I've never worked with Django and I am having trouble figuring out how to get my changes to compile and be available online.
What I know so far is that the application is currently available online. netstat tells me that httpd is listening on port 80. My change was made in the myapp/views.py file.
I tried to restart httpd using services httpd restart but my changes did not take effect. I've been looking into the issue a bit an I believe that I need to run a command along the lines of:
I tried calling python manage.py runserver MY.IP.AD.DR:8000 and I get:
python manage.py runserver 129.64.101.14:8000
Validating models...
0 errors found
Django version 1.4.1, using settings 'cutsheets.settings'
Development server is running at http://MY.IP.AD.DR:8000/
Quit the server with CONTROL-C.
Nice that no errors are found but when I navigate to http://MY.IP.AD.DR:8000/ I just get a "Unable to connect" message from my browser. I tried with port 81 too and had the same problem.
Without knowing exactly how your application is set up, I can't really say exactly how to solve this problem.
I can tell you that it's quite common to use two web servers with Django - one handles the static content, and reverse proxies everything else to a different port where the Django app is listening. Restarting the normal HTTP daemon therefore wouldn't affect the Django app, so you need to restart the one handling the Django app. Until you restart it, the prior version of the code will be running.
I generally use Nginx as my static server and Gunicorn with the Django app, with Supervisor used to run Gunicorn, and this is a common setup. I recommend you take a look at the config for the main web server to see if it forwards anything to another port. If so, you need to see what server is running on that port and restart it.
Also, is there a Fabric configuration (fabfile.py)? A lot of people use Fabric to automate Django deployments, and if there is one then there may be a command already defined for deploying.

How do I access my django app running on Amazon ec2?

So, I have looked around stack overflow + other sites, but havent been able to solve this problem: hence posting this question!
I have recently started learning django... and am now trying to run it on ec2.
I have an ec2 instance of this format: ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com on which I have a django app running. I changed the security group of this instance to allow http port 80 connections.
I did try to run it the django app the following ways: python manage.py runserver 0.0.0.0:8000 and python manage.py runserver ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com:8000 and that doesnt seem to be helping either!
To make sure that there is nothing faulty from django's side, I opened another terminal window and ssh'ed into the instance and did a curl GET request to localhost:8000/admin which went through successfully.
Where am I going wrong? Will appreciate any help!
You are running the app on port 8000, when that port isn't open on the instance (you only opened port 80).
So either close port 80 and open port 8000 from the security group, or run your app on port 80.
Running any application on a port that is less than 1024 requires root privileges; so if you try to do python manage.py runserver 0.0.0.0:80 as a normal user, you'll get an error.
Instead of doing sudo python manage.py runserver 0.0.0.0:80, you have a few options:
Run a pre-configured AMI image for django (like this one from bitnami).
Configure a front end server to listen on port 80, and then proxy requests to your django application. The common stack here is nginx + gunicorn + supervisor, and this blog post explains how to set that up (along with a virtual environment which is always a good habit to get into).
Make sure to include your IPv4 Public IP address in the ALLOWED_HOSTS section in Django project/app/settings.py script...

python manage.py runserver not work

I am trying to learn django on my mac by following along with Writing your first Django app
I run
django-admin.py startproject mysite
and it creates the files it should. Then I try to start the server by running
python manage.py runserver 8080
It's OK,the message is :
Validating models...
0 errors found Django version 1.4.2, using settings 'mysite.settings'
Development server is running at http:// 127.0.0.1:8080/ Quit the
server with CONTROL-C.
But I when I visit the 127.0.0.1:8080, I get a 504 error page:
This Page Cannot Be Displayed
The system cannot communicate with the external server ( 127.0.0.1 ).
The Internet server may be busy, may be permanently down, or may be
unreachable because of network problems. ......
What am I missing here?
Considering you are using a proxy (as mentioned in the comments). The reason for this error:
This Page Cannot Be Displayed
The system cannot communicate with the external server ( 127.0.0.1 ). The Internet server may be busy, may be permanently down, or may be unreachable because of network problems. ......
is that 127.0.0.1 is looked up at the proxy and on the proxy server there is nothing listening on port 8080
Use 'python manage.py runserver 8000' instead of 'python manage.py runserver 8080'
Worked for me.

Categories