1

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?

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Probably you have django.py module in your working directory or in any other that is in python path.

Comments

0

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'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.