When, from Eclipse, i run my django project, it throws
ImportError django.contrib.messages: No module named messages
Furthermore, in django consolle import django.contrib works fine, it throws
ImportError: No module named messages
Why?
In my django folder, where the python interpreter of pydev points, there is ./contrib/messages folder, so i don't understand why it can't find django.contrib.messages
I have resolved deleting old version of django that was in /usr/lib/pymodules/python2.6/
and reinstalling django.
Related
I have an old Django project. I upgraded to Django 1.6 and I want to see if it still runs. I did all the upgrades like change url names, but I did not change the structure. It runs perfectly fine from the command line, but when I run it in Pydev I get
ImportError: Could not import settings 'project.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named project.settings
What can I do to run it in Pydev?
I have just experienced the same problem and the solution was to set the Django settings module in the project properties. Right click on the project, then click Properties, go to PyDev - Django and set the Django settings module text field's value to the desired settings file.
I use django-haystack 2.0.0 to index my site, and it has been working great until I upgraded to Django 1.5 and started using the WSGI interface. If I just use the django_gunicorn command it works great, but the Django documentation "highly recommends" I use the gunicorn command.
When I start my site with the gunicorn command, Haystack throws the following error on any page load:
ImportError: cannot import name signals
I have no problems importing signals from the Django or Python shells. I use virtualenv and install all packages locally inside that environment. My wsgi.py file looks just like the default one in the django admin, except that I add the local path to the python path as such:
path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2])
if path not in sys.path:
sys.path.append(path)`
Any help you could provide would be very appreciated, thank you!
I don't use gunicorn, but I had the same problem when I used the HAYSTACK_SIGNAL_PROCESSOR setting to point to a custom class that I wrote. That class imported one of my models, which eventually propagated up the import chain, to import my settings module, thus causing a circular import.
When using a setting such as HAYSTACK_SIGNAL_PROCESSOR that points to a class, make sure that class standsalone, and doesn't import either directly or indirectly the Django settings file.
I am using django with mod_python (I know it is deprecated -- I am just doing this for an exercise), and am getting the following error --
"Could not import project.views. Error was: No module named app.models"
I am getting the 'No module named app.models" in several other places as well. My syncdb is working fine, and if I go into the manage.py shell I can import the models fine. Why is this occurring and what do I need to change? Thank you.
You should use absolute imports everywhere. If your project is structured like so:
/project/settings.py
/project/app/models.py
/project/app/views.py
In INSTALLED_APPS you would use project.app. In app you'd import your models into views: import project.app.models, etc. Alternately you can try adjusting your PYTHONPATH so your imports work. When you run ./manage.py you are in your project folder, and Python automatically adds it to the PYTHONPATH. This doesn't happen automatically in most deployment scenarios (mod_python or other wise).
Hi I am trying to implement Django simple capcha into my app but when i try to import from view.py "from captcha.fields import CaptchaField" i get an error "No module named fields". but i am able to import this in the django shell terminal. What else am i missing
Did you add captcha to the INSTALLED_APPS in your settings.py?
If so, did you install it, where did you install it, and is it on your Python path?
I encountered same problem before and I installed django-simple-captcha. It worked finally
I am trying to setup django with fastcgi on apache. Django is installed and seems to be running correctly but I am having problems with setting up fastcgi.
I decided to test out my dispatch.fcgi script in the interactive python shell line by line and the following line:
from django.core.servers.fastcgi import runfastcgi
results in the following error:
ImportError: No module named core.servers.fastcgi
I can import django with no problem but import django.core gives yet another ImportError (No module named core).
How can I go about ensuring that I can import django.core. If I can import django then in must be on my path, and so why can I not import core?
You probably have a file/folder called django somewhere in your path, that isn't the actual path.
try this
import sys
sys.path
And then check everything in that output to see if there is a file/folder called django(.py) somewhere.
If so, change the path (sys.path = ['/path/to/directory/below/django/install'] + sys.path) or move/rename the file.
Probably you have django.py module in your working directory or in any other that is in python path.
For anyone having this problem and coming across this question like I did, it turns out that fastcgi support has been removed as of Django 1.9, thus you will get this import error if trying to import it. Refer Using Django with virtualenv, get error ImportError: No module named 'django.core.servers.fastcgi'