I have a problem with access to my REST Django data. As u already understand, I have a Django app whith standart REST localhost with my data. My another application, which i made in ReactJS, got Json file with data using axios throught standart GET ajax request. Now i wanna to connect to my React app from another computer at the same network and it's go easily using http://ip4:3000. But in that way i can't get data from REST page which i have on my localhost:8000. I try to get data from terminal in the same way using ip + localhostport, but i always got an error :
curl: (7) Failed to connect to 106.120.89.142 port 8000: Connection refused
I can't do it using browser to, someone know solution for that?
You can start a django development server with
./manage.py runserver 0.0.0.0:8000
this will open your port and make django app to be visible from outside world.
Related
So, I am trying to make an API server on postman. Somehow it doesn't want to start. I know I have a crap computer, but I can run this many pages.
So, back to the problem. I am trying to run GET localhost:3000/users?id=hiddenIDsoyoucanthackme and it says this:
Hmmm… can't reach this page: localhost refused to connect.
Try:
Search the web for localhost
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
Back on the problem. Same at Postman.
Error: connect ECONNREFUSED 127.0.0.1:3000
Help.
I am running a Django project with react redux (trying to implement authentication system) and the very weird thing i observed that my site is rendering properly when i use localhost:8000 or http://127.0.0.1:8000.
But when i m trying to login/signup (ie trying to send post request) then it working only when i use localhost:8000, and giving some error when using http://127.0.0.1:8000.
One of the error when using http://127.0.0.1:8000 is shown below.
However i have seen this and found localhost will often resolve to ::1, the IPv6 loopback address. But i am getting is it related to this or not ?
And whether localhost:8000 and http://127.0.0.1:8000 is same or not ?
Please try to answer in simple words because I have not much knowledge of internet protocol or networking.
This problem is because of CORS. You have to enable from outside your application.
This happens because django apps and generally all frameworks blocks requests outside your address.
You can read more about CORS here
I have a django application that I want to deploy using daphne.
Django application supports both websockets and http requests. I've converted the django to support ASGI.
I'm starting the server using :
daphne <project_name>.asgi:application
The server is able to accept websocket connections but unable to handle the incoming HTTP requests (throws 404).
Where am I going wrong over here?
P.S.: I'm not using django channels.
I had forgotten to instantiate 'get_asgi_application' while creating the django application. Hence, it wasn't able to accept HTTP requests.
I have a django web app running via gunicorn and nginx is serving as a reverse proxy.
The web app provides few API calls. One of the API call (let's say GET /users) is giving me a Connection timed out error. All other HTTP calls work fine always.
If i restart the Django/gunicorn process, GET /users works fine for a couple of hours and then starts giving same problem again.
GET /users is simply parsing query params and pushing some data into rabbitmq. It's not the issue with rabbitmq connection/channel, that i am positive.
Anyone has any idea what could be wrong?
I have tried all available solutions on stackoverflow (including modifying proxy* headers in nginx, changing gunicorn timing and what not.)
I am currently working on a web project in django and there is a requirement to ensure the safety of transmitting data over a network (passwords, usernames etc.).
I've read on owasp cheat sheet about authenication that for safety reasons all passwords should be sent from a client to a server over tsl protocol.
https://www.owasp.org/index.php/Authentication_Cheat_Sheet#Transmit_Passwords_Only_Over_TLS_or_Other_Strong_Transport
Django framework sends these over http protocol. Is it possible to make django send it over tsl or work around it in another way?
When you run a Django application on the Internet, it's usually looking something like this:
[Django Application] <-> [uWSGI] <-> [nginx] <-> [web browser]
You can use different components, e.g. Gunicorn instead of uWSGI or Apache instead of nginx.
The thing is, you simply configure the webserver (Apache or nginx or whatever) with an SSL certificate and listen for https instead of http.
I think you're using Django runserver command for server your app over HTTP. It is absolutely not made for production and is a really HTTP (only) server for development.
For serve your app across SSL/TLS, you must use a frontend as described in henrikstroem's response