Django runserver on Chromebook (Crostini) - django

I'm using a Chromebook HP 11 G5 EE and try to develop with Django.
I use Crostini (Linux terminal into Chrome OS with no developper mode).
I've created a virtualenv inside my home directory and installed with pip all my requirements.
When I try to do (with source bin/activate) :
./manage.py runserver
It returns me :
Performing system checks...
System check identified no issues (0 silenced).
May 28, 2019 - 20:02:11
Django version 2.1.5, using settings 'myproject.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Error: You don't have permission to access that port.
I'd try to set parameters like 0.0.0.0:8000, penguin.linux.test:8000, to change ports, I've got the same error.
Is someone had the same issue and fixed it ?
Thanks !

How about this:
./manage.py runserver 0.0.0.0:8000

Related

Not able to connect to django rest server at http://127.0.0.1:8000/

I have used the same code as the tutorial on the
drf website
When i run
python manage.py runserver
it gives me this in the terminal
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 10, 2021 - 07:12:08
Django version 3.2.5, using settings 'drftut.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Firefox gives me this error:
The connection has timed out
The server at 127.0.0.1 is taking too long to respond.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
I'm also using wsl1 and vscode remote desktop for wsl and im running this inside a python enviroment
kill $(lsof -t -i:8000)
Use this command in terminal or cmd to kill the process which is already running on PORT 8000.
If this is also not worked for you, then try to runserver on another PORT like so python manage.py runserver 5000 or any other free port

django app not being served on digitalocean droplet

I'm following this tutorial online https://simpleisbetterthancomplex.com/tutorial/2016/10/14/how-to-deploy-to-digital-ocean.html
I get to an intermediary step where I want to check if I can access the app on the IP address. I run python manage.py runserver 0.0.0.0:8000 which returns the following:
System check identified no issues (0 silenced).
November 22, 2018 - 17:41:08
Django version 2.1.3, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
So no errors. Then I navigate to my_droplet_ip:8000 and I get a timeout. "took to long to respond."
I am running the runserver command from a user rather than root. Don't know if that matters...
Any idea what's going on here?
I had to expose the port 8000 by running the command sudo ufw allow 8080. Wasn't mentioned anywhere in the tutorial...

Django installation admin page not getting

I installed Django and created myproject & myapp by refer the tutorial https://www.tutorialspoint.com/django/django_creating_project.htm
I got below output while run the command $ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
January 05, 2018 - 06:32:21
Django version 1.11, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
But while I run the URL in the browser http://127.0.0.1:8000/admin/, it shows "Unable to connect"

Django project 'site cant be reached'

I've created a Django project and a virtual environment where I installed python on my Ubuntu server. When I try to run the development server by typing
$ ./manage.py runserver 0.0.0.0:8000
I get the usual
Performing system checks...
System check identified no issues (0 silenced).
April 01, 2017 - 11:36:55
Django version 1.10.6, using settings 'myproject.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
However, when I go to the site [my ip address]:8000 I get a 'This site can’t be reached' message, anyone know any causes for this? thanks
It was a security group problem in the server, I didn't have custom TCP rule 8000 enabled

django tutorial returns 'ERR_EMPTY_RESPONSE'

I'm following the django tutorial: version 1.8, Ubuntu 10.04, python 3.4 in a virtual environment. I seem to create a django project (yatest) on my Ubuntu server just fine and I start the development server:
(v1)cj#drop1:~/www/yatest$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
August 09, 2015 - 04:37:33
Django version 1.8.3, using settings 'yatest.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
but when I browse to http://myserver:8000 all I get in response is 'ERR_EMPTY_RESPONSE'.
This is the first part of the tutorial before an app is even created. At this early stage in the tutorial it doesn't mention any error log I can check. My telnet client doesn't say anything crashed, and 'ctl-c' will shutdown the server process with no complaints.
Using netstat -lntp I verified no other processes are using port 8000. I do not have Apache installed. I do have gunicorn and nginx installed but both are stopped and not in use yet in the tutorial.
I'm rather new to linux; I could use some help finding an error log or other debugging tools to solve this. I don't doubt I've missed some basic OS setting or something to enable TCP access, etc..
Thanks
Clark
Found my mistake. When starting a dev django server on dedicated server one MUST include the dedicated server's address in the command. This is not needed when launching a dev server on the same machine as your browser. So instead of
$python manage.py runserver
you have to run
$python manage.py runserver <server ip>:8000.
So this is my inglorious start on stack exchange. You saw nothing! :P
If you're running natively in an virtual envrionment, then you need to specify a port and address:
python manage.py runserver 127.0.0.1:8000
For containers, it's easiest to listen to all addresses:
python manage.py runserver 0.0.0.0:8000
For anybody using PyCharm in a docker environment, it's also worth knowing that PyCharm will override your docker-compose configuration to change the runserver command to bind to the port specified in the Host option in your Run/Debug Configurations window.
Make sure you set the Host to 0.0.0.0 and the port to 8000 if you want to use the debugger etc.
If you don't want the trouble to determine server ip (ie when you're using containers), you can listen to 0.0.0.0:8000
python manage.py runserver 0.0.0.0:8000