Whitenoise,Mezzanine,Django ImportError:无法导入名称ManifestStaticFilesStorag

2024-04-23 21:18:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在heroku上部署我的夹层项目。最后一个错误给了我一个最终的堆栈-ImportError:无法导入名称ManifestStaticFilesStorage。以下是我的核心项目结构:

├── deploy
│   ├── crontab
│   ├── gunicorn.conf.py.template
│   ├── local_settings.py.template
│   ├── nginx.conf
│   └── supervisor.conf
├── dev.db
├── fabfile.py
├── flat
│   ├── admin.py
│   ├── admin.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── tests.py
│   ├── views.py
│   └── views.pyc
├── __init__.py
├── __init__.pyc
├── manage.py
├── Procfile
├── README.md
├── requirements.txt
├── runtime.txt
├── settings.py
├── staticfiles -> mezzanine_heroku/staticfiles
├── urls.py
├── urls.pyc
└── wsgi.py

在wsgi.py公司名称:

^{pr2}$

程序文件:

web: gunicorn wsgi

从heroku日志回溯:

ImportError: cannot import name ManifestStaticFilesStorage

2016-09-02T18:02:36.124458+00:00 app[web.1]: Traceback (most recent call last):
2016-09-02T18:02:36.124494+00:00 app[web.1]:   File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2016-09-02T18:02:36.124529+00:00 app[web.1]:     sys.exit(run())
2016-09-02T18:02:36.124558+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
2016-09-02T18:02:36.124620+00:00 app[web.1]:     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2016-09-02T18:02:36.124646+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 192, in run
2016-09-02T18:02:36.124706+00:00 app[web.1]:     super(Application, self).run()
2016-09-02T18:02:36.124709+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
2016-09-02T18:02:36.124754+00:00 app[web.1]:     Arbiter(self).run()
2016-09-02T18:02:36.124800+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 218, in run
2016-09-02T18:02:36.124858+00:00 app[web.1]:     self.halt(reason=inst.reason, exit_status=inst.exit_status)
2016-09-02T18:02:36.124862+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 331, in halt
2016-09-02T18:02:36.124962+00:00 app[web.1]:     self.stop()
2016-09-02T18:02:36.124966+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 381, in stop
2016-09-02T18:02:36.125047+00:00 app[web.1]:     time.sleep(0.1)
2016-09-02T18:02:36.125057+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 231, in handle_chld
2016-09-02T18:02:36.125138+00:00 app[web.1]:     self.reap_workers()
2016-09-02T18:02:36.125141+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 506, in reap_workers
2016-09-02T18:02:36.125241+00:00 app[web.1]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2016-09-02T18:02:36.125304+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2016-09-02T18:02:36.182785+00:00 heroku[web.1]: State changed from starting to crashed
2016-09-02T18:02:36.175782+00:00 heroku[web.1]: Process exited with status 1

最令人困惑的是ImportError: cannot import name ManifestStaticFilesStorage错误。在


Tags: runinpyselfappherokuinitlib
1条回答
网友
1楼 · 发布于 2024-04-23 21:18:24

在django1.7中引入了ManifestStaticFilesStorage。你用的是老版本的Django吗?如果是这样,您应该升级到supported version。在

仍然可以在Django的旧版本中使用WhiteNoise 2.0.6,但我和Django团队都不支持这一点。在

相关问题 更多 >