Can't start server in openshift - python

I have deployed django with quick start.
When I try to start django-server with python manage.py runserver in SSH-Terminal, I get following error:
Performing system checks...
System check identified no issues (0 silenced).
October 04, 2015 - 20:56:45
Django version 1.8.2, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Error: You don't have permission to access that port.
How can I start the django-server successfully?

You seem to have a few things that you are doing that are probably causing the issues that you are encountering.
You should not use the runserver command to start the server in a
production environment, that is only to run a local server for
development purposes.
You can't start a server on port 8000 on openshift, you need to
start it on port 8080, see:
https://developers.openshift.com/en/managing-port-binding-routing.html
The current version of the django quickstart (#464680f on Sep
9) is not working properly, you can use this repo for the moment:
https://github.com/jsvgoncalves/django-openshift
Edit: The bug reported in 3. was fixed here: https://bugzilla.redhat.com/show_bug.cgi?id=1308722
Also, as per the README.md of that repo, you should set the $OPENSHIFT_PYTHON_WSGI_APPLICATION environment variable to the path of wsgi.py.

Related

Make the output of Django runserver flush in Git Bash

When I issue python manage.py runserver under Git Bash, only one line of output appears:
Watching for file changes with StatReloader
The remaining output appear when I either stop the server or make a change in the code:
Performing system checks...
System check identified no issues (0 silenced).
September 01, 2021 - 23:11:21
Django version 3.2.7, using settings 'newserver.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
How do I make it flush right away?
I modified manage.py using the code from here. This solved the problem.

Can't connect to django application running on AWS Ubuntu EC2

I am runnig my Django application on AWS EC2 t2.micro with Ubuntu. I've successfuly installed all modules, created a PostgreSQL database, and made all migrations. Now when I'm running python manage.py runserver 172.31.27.208:8000 I can't connect to it in browser, getting ERR_CONNECTION_TIMED_OUT error.
python manage.py runserver 172.31.27.208:8000 returns:
System check identified no issues (0 silenced).
January 30, 2020 - 11:10:59
Django version 3.0.2, using settings 'project_test.settings'
Starting development server at http://172.31.27.208:8000/
Quit the server with CONTROL-C.
So I assume the server running properly.
I am using private ip form ec2 console which, I've checked, is matching to the ip adress returning by running command ifconfig.
TCP port is opened in AWS security_group inbound rules on port 8000.
I've also checked netstat -lan after running django server, it shows:
tcp 0 0 172.31.27.208:8000 0.0.0.0:* LISTEN
I have been looking for same issues and everything listed in them seems to be correct in my case. Since that I have no idea what is going wrong. Can provide more information if you need something. Will appriciate any help. Thank you.

How to fix the connection error in django

I have created a new project in django. when I run python manage.py runserver, I am getting the msg in command prompt like below.
/var/www/samplepro/myapp$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
March 26, 2015 - 10:52:31
Django version 1.7.7, using settings 'myapp.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
when I test in browser, I am getting the page can't be displayed error. Can anyone help me to do get the django page.
You stated that you are running the server on Ubuntu while you are trying to connect it from another PC running Windows. In that case, you should replace the 127.0.0.1 with the actual IP address of Ubuntu server (the one you use for PuTTY).
I am also developing in a virtual machine.
Use ifconfig to figure out the IP address that has been assigned to your virtual machine.
Then start the server with:
python manage.py runserver <IP>:8000
Of course you could also use a different port instead of 8000. Then use that address and port in your host browser to access your server.
Note: At least in my VM, the virtual machine gets a new address from time to time, so check that in case you have trouble starting your server with the same command.
If this does not help, check your hosts file as mentioned in one of the comments.

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.

c9.io Error: You don't have permission to access that port

So i was doing a django tutorial this weekend using the Cloud9 IDE on their web app c9.io. All is good and dandy until i get to the piece of running the server python manage.py runserver
You would think that it would work fine but i keep on getting this stuff.
python manage.py runserver
Validating models...
0 errors found
February 22, 2014 - 23:42:03
Django version 1.5, using settings 'djangotut.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Cloud9 Your application is running at https://djangotut-c9-diaz994.c9.io
Cloud9 Error: you may be using the wrong PORT & HOST for your server app
use './manage.py runserver $IP:$PORT' to run your Django application
**Error: You don't have permission to access that port.**
I do not know why it is not allowing me to run this. It seems like it starts the server and then it kills it. Have any of you had experience with this on the c9.io site? Thanks alot.
They don't allow access to the standard ports that django wants to use, but they do provide the appropriate ports in the form of environment variables. Use this instead:
python manage.py runserver $IP:$PORT
That should work.
Yes, thats right. First use
python manage.py runserver $IP:$PORT
to start the development server and than don't forget to add allowed hosts to your settings.py
ALLOWED_HOSTS = ['<your_project_name>.c9users.io']

Categories