Make the output of Django runserver flush in Git Bash - python

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.

Related

Server running on a loop and reloading the same file again and again

I am running a project in my virtualenv on Django but constantly getting this issue the error I get is
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/Users/Saujan/Desktop/FinalProject/netscan/apps/core/
templatetags/general_info.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
April 23, 2019 - 15:48:31
Django version 2.2, using settings 'config.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/Users/Saujan/Desktop/FinalProject/netscan/apps/core/
templatetags/general_info.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
April 23, 2019 - 15:48:33
Django version 2.2, using settings 'config.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/Users/Saujan/Desktop/FinalProject/netscan/apps/core/
templatetags/general_info.py changed, reloading.
(netscan_venv) Saujan:netscan Saujan$
I had the same issue. The problem in my case is that the folder where I had the project was getting synced by dropbox. So it was in constant change. Once the synced was done I was able to run the server without any issue.

manage.py runserver opens up pycharm instead of running server

I'm pretty new to coding in general and could really use someones help with this! I installed django via CMD on my WIN 10 computer and when I run the server it works.
D:\Python\Python37-32\website>manage.py runserver 8080
Performing system checks...
System check identified no issues (0 silenced).
August 04, 2018 - 15:32:59
Django version 2.1, using settings 'website.settings'
Starting development server at http://127.0.0.1:8080/
Quit the server with CTRL-BREAK.
However... I than downloaded Pycharm Community edition on my computer and instead of the server starting, it just opens up the pycharm ide and the server doesnt run. The interpreter looks fine as well.
D:\Python\Python37-32\website>manage.py runserver 8080
D:\Python\Python37-32\website>
You should change default program for .py files from pycharm to "python"
Simple solution:
python manage.py runserver
However, If you want to run this as manage.py runserver, you should change the default program for .py files from PyCharm to Python:
Right click on any .py file > Properties > General tab > Opens with > Change
(No need to uninstall / reinstall PyCharm)
Then, when you try calling manage.py runserver, you can face another problem:
command line arguments (runserver in our case) will not be passed to the program.
The solution to the problem will be some registry configuration:
[HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command]
#="\"C:\\Python38\\python.exe\" \"%1\" %*"
The registry setting above adds the %* to pass all arguments to python.exe
via: mckoss's answer on stackoverflow

Can't start server in openshift

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.

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.

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