Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

django - ImportError: cannot import name get_path_info

My question is why foreman start not serving css file in dev environment ...? but my app running perfectly fine in heroku production server. Correct me if i am wrong, i thought dj-static is the only option for serving static in foreman env, so in order to work dj-static in wsgi.. follows...

wsgi.py 
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

if i am changing above code to

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readtamil.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
application = Cling(get_wsgi_application())

then foreman start gives me this error

ImportError: cannot import name get_path_info

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try setting dj-static==0.0.6 in your requirements.txt file for Virtualenv. There might be a versioning issue on PyPI or a Django1.7 issue or the Heroku tutorial shows to use 0.0.5.

I've reported this issue to Heroku and their tutorial is now updated to reflect newer versions in the requirements.txt.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...