Forums

ImportError: cannot import name application

Hey, I have created an app on server using manual configaration, but I am facing problem in importing the application for the same. In wsgi.py file I have used following code to import my app.

import os
import sys

path = '/home/pjbardolia/mysite'
if path not in sys.path:
    sys.path.append(path)

from twitter import application

Now as far as I can understand the application import in python, the file named twitter.py in mysite is the one that I want to run and I am naming the same to import in the import application. Can you tellme where I am going wrong? Thanks in advance

Hi there, I see you've posted another question somewhere else, so I'll help over there. In case anyone else sees this, you should check out our help page on import errors. I think this particular problem may have been to do with the file name being twitter.py, and a possible name-clash with a system version of a library called twitter. Maybe renaming twitter.py to something like my_twitter.py would have worked.