Django Shell in Eclipse not starting

198 views Asked by At

I am getting this error message when I try to run the shell from Eclipse Neon while I can successfully run the Django shell from command window. I am using Python 3.4 and Django 1.10. Any idea where the problem is?

enter image description here

WSGI file:

'''
WSGI config for MyProject project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
'''

import os
from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MyProject.settings")

application = get_wsgi_application()
1

There are 1 answers

0
PythonTester On BEST ANSWER

I beleive This is a known bug in Eclipse Pydev.

https://www.brainwy.com/tracker/PyDev

Fixed for 5.6

Git: 2c8cd03 2017-03-12 Fabio Zadrozny #PyDev-752: Django version not detected if > 1.10

And a fix has been posted for it.

You could try start a python shell as normal, then:

import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
import os; os.environ['DJANGO_SETTINGS_MODULE'] = '<Project Name>.settings'; import django
sys.path.append(os.path.expanduser('<path to your project>'))
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Replace 'Project Name' with your project name and 'path to your project' with your path

alternatively, use a pre 1.10 version of Django i.e 1.7