问题描述
我的问题是为什么工头开始不在开发环境中服务css文件?但是我的应用程序在heroku生产服务器中运行得很好。纠正我,如果我错了,我以为 dj-static
是在工头env中静态服务的唯一选择,所以为了在wsgi中工作dj-static。 .. wsgi.py
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
如果我正在将上述代码更改为
import os
os.environ.setdefault(DJANGO_SETTINGS_MODULE,readtamil.settings)
from django.core.wsgi import get_wsgi_application
from dj_static导入Cling
application = Cling(get_wsgi_application())
然后,工头开始给我这个错误
在Virtualenv的requires.txt文件中尝试设置 dj-static == 0.0.6
。在PyPI或Django1.7问题上可能存在版本问题,或者Heroku教程使用0.0.5。
我已将此问题报告给Heroku及其教程现在已更新,以反映Requirements.txt中的较新版本。
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
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.
这篇关于ImportError:不能导入名称get_path_info的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!