can't get django to work in eclipse + windows - django

I've installed django on my windows machine, added the pydev and django plugins for eclipse, create a django project, and ran manage.py createapp to create one app. Now when I run manage.py runserver (via eclipse's "custom command" option") It says Validating models... but when I go to http://localhost:8000 I get no response, as though the server is not running. What am I doing wrong?

Try running with --noreload to avoid getting two processes. It helps with error output redirection in eclipse, and may give you more hints towards the actual problem.
Also, do the same from the command-line to see if you get the same problem.
Update: Per Fabio's comment above, you can work around this problem by hacking the code, as explained in this question.

Related

Django webserver automatically shuts off on local server when I try to access the admin section

I'm a noob trying to learn Django for the first time, I created a project in a virtualenv on Windows 10. It worked well in the beginning where I was able to login to the admin section after running '''python manage.py runserver'''
But now when I run the same command I'm able to see the Django landing page but as soon as I try to hit http://localhost:8000/admin/ or http://127.0.0.1:8000/admin the server automatically disconnects and I get the "This site can’t be reached" error on Chrome.
I tried changing the port number by running python manage.py runserver 0.0.0.0:8001 but it didn't work. I tried to check if the port (8000) is currently in use by running the cmd (as an admin) netstat -a -b but couldn't find any issues.
The server just quits without any error message
Edit: Currently using Python 3.7.0 and django-3.0.1
There's a ticket about this issue: https://code.djangoproject.com/ticket/31067.
This seems to be a bug in Python 3.7.0, and appears to be fixed in Python 3.7.1. It's still unknown what the exact trigger is for this bug.
Since Django officially only supports the latest patch release of a Python series, this won't be fixed in Django. You can either upgrade your Python version to the latest patch release of 3.7, or downgrade Django to 2.2.
It's a Django 3.0 issue as I've seen. There are so many issues on GitHub, regarding this error.
You may try downgrading to Django 2.* versions for now. Version 2.1/2.2 works fine.

Django 2.1.5 migration does not happen with makemigrations command

In our Django project(Django 2.1.5), every time we try to run the project we have to give the '--noreload' command in addition to the runserver command, else the project returns an error as,
ValueError: signal only works in main thread
We are using Django signals to communicate between the apps created in Django and Web-sockets in Threading aysnc-mode to connect between the other services involved in the project. When we try to deploy the project in Jenkins, this becomes a problem and we are using Nginx as the webserver for host the application. Is there any possibility to solve the issue of '--noreload' and run the application normally?
We are not sure if its because of the same problem referred above but we have a problem when trying to migrate the changes in the Models in Django, it always returns
No changes Detected
After a quick internet search, we did the migrations by mentioning the app names and it did work, yet the terminal stays still after the migrating and waits to manually terminate the process.
Is there a possible solution to overcome this? and also we would like to know where we go wrong

Django Runserver crashes due to autoreload?

so i'm very new to Django. But my problem is as follows:
When I create a project, the runserver often won't start. I type:
python manage.py runserver
Powershell freezes for a while and says: "Python is not responding"
The Problem does not appear when typing:
python manage.py runserver --noreload
I am using Windows 10 and Django 1.10.6 as well as Python 3.6
The problem has also been reported on the forum of djangoproject but there was no solution offered. Is there any way to fix this?
Will disableling autoreload affect working with the Localhost?
Thank you.
I just started encountering this same bug tonight. I'm not sure how to fix it just yet or what causes it, but running with --noreload won't hurt anything. The server just won't reload when you make a Python change, so you'll have to restart the server yourself to test changes.

Can't start Django 1.7.1 development server

I migrated my Django app from 1.4.3 to 1.7.1
I got it working for a short while
but now every time I try to run the development server it gets stuck on:
C:\Users\DAVID\Documents\TinyTap-web\tinytap>python manage.py runserver
Performing system checks...
System check identified some issues:
WARNINGS:
?: (1_6.W001) Some project unittests may not execute as expected.
HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure
. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information.
System check identified 1 issue (0 silenced).
the localhost is not working , also tried with other IP/ports = same results.
I could get rid of this warning by adding TEST_RUNNER = 'django.test.runner.DiscoverRunner' to the settings file, but still development server is not running
Apparently it was related to migrations and "CircularDependencyError".
After deleting the database , and the migration folders and running manage.py migrate
I was finally able to runserver
Trying creating a new project
django-admin.py startproject mysite
If it works then there's problem with the current project you're trying to run. (You'll need to give us more information for us to help)

django-rosetta not saving translations on hitting "Save and Translate next block" in Chrome

django-rosetta is not saving the translations on hitting "Save and Translate next block" in Chrome.
It seems to be working fine in Firefox though. I tried clearing cache so that does not seem to be an issue.
On Chrome, after entering translated text and hitting the "Save.." button, I'm redirected to the main screen without my changes being saved.
I updated to the most recent version of rosetta thinking that the Issue13 fix would solve my problem but it does not.
I've also made sure that my .po and .mo files have 777 permissions.
Been a long time, not sure if you were able to sort it out?
I have a dev environment running Django 1.4.2 and Rosetta 0.6.8 on Lion and it works flawlessly. Im setting it up with the python manage.py runserver command.
Then when I wanted to deploy it to my Ubuntu 12 server Rosetta started to behave quite weird. I installed Nginx as a proxy and was running apache with wsgi. Same versions besides that. It was not just the translated strings that were not being saved but the navigation became absolute random. Did not matter what button I pressed, I suspected the proxy configuration wasn´t setup properly since I could run it locally in my dev.
To make a long story short, I finally shutdown nginx and apache and just ran django with the builtin and hence got the django logs in my terminal. It got a lot of errors that made the server restart itself every few seconds. This obviously explained the somewhat non-reliable behavior of the app. I dumped the database in production and resynced it. Now when I runserver in production it works just as good as in my dev. When I plug in apache to do the job (going around nginx for the moment) the problem still persist, not as bad as before though. Browser does not make any difference.
One of the errors that did pop up was this
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1781710>>
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 50, inapport_excepthook
if not enabled():
TypeError: 'NoneType' object is not callable
Still havent solved this but will be posting the solution when I do.
EDIT:
Scratched the good ol´ apache wsgi setup and went for Gunicorn instead. Works really well now, not sure what that was all about but I´m quite happy with the new setup anyways.
Here´s a good setup guide
http://ijcdigital.com/blog/django-gunicorn-and-nginx-setup/
hopefully this helps someone in the future!