[英]Heroku Django error run the app
所以我在這里和其他論壇上嘗試了很多東西,沒什么。 因此,請幫助我解決此類問題。 command but once I put it to the server I cant run it, this is my traceback: 我在python和Django中是一個非常新的人,我創建了一個小應用程序,它可以與命令完美配合,但是一旦將其放到服務器上就無法運行,這是我的回溯:
~ $ gunicorn trydjango18.wsgi:application
2016-02-19 20:22:50 [17] [INFO] Starting gunicorn 18.0
2016-02-19 20:22:50 [17] [INFO] Listening at: http://0.0.0.0:56762 (17)
2016-02-19 20:22:50 [17] [INFO] Using worker: sync
2016-02-19 20:22:50 [22] [INFO] Booting worker with pid: 22
2016-02-19 20:22:50 [22] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
File "/app/trydjango18/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup()
File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named crispy_forms
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
File "/app/trydjango18/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup()
File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named crispy_forms
2016-02-19 20:22:50 [22] [INFO] Worker exiting (pid: 22)
2016-02-19 20:22:50 [17] [INFO] Shutting down: Master
2016-02-19 20:22:50 [17] [INFO] Reason: Worker failed to boot.
~ $
在我安裝crispy_forms
並運行了heroku run python manage.py collectstatic --noinput Running python manage.py collectstatic --noinput on blooming-wave-82922... !!! ▸ Cannot run more than 1 Free size dynos.
之后,在heroku run python manage.py collectstatic --noinput Running python manage.py collectstatic --noinput on blooming-wave-82922... !!! ▸ Cannot run more than 1 Free size dynos.
heroku run python manage.py collectstatic --noinput Running python manage.py collectstatic --noinput on blooming-wave-82922... !!! ▸ Cannot run more than 1 Free size dynos.
~ $ gunicorn trydjango18.wsgi:application
2016-02-19 22:36:07 [21] [INFO] Starting gunicorn 18.0
2016-02-19 22:36:07 [21] [INFO] Listening at: http://0.0.0.0:10012 (21)
2016-02-19 22:36:07 [21] [INFO] Using worker: sync
2016-02-19 22:36:07 [26] [INFO] Booting worker with pid: 26
2016-02-19 22:36:07 [26] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
File "/app/trydjango18/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup()
File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named registration
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
File "/app/trydjango18/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup()
File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named registration
2016-02-19 22:36:07 [26] [INFO] Worker exiting (pid: 26)
2016-02-19 22:36:08 [21] [INFO] Shutting down: Master
2016-02-19 22:36:08 [21] [INFO] Reason: Worker failed to boot.
~ $
在應用程序的基本級別目錄中,您有一個requirements.txt
文件,Heroku使用該文件來安裝所有需要的庫/軟件包。
復制用於開發的環境的最簡單方法是cd到該目錄,然后運行pip freeze > requirements.txt
。 這將創建一個反映您的開發環境的文件。 提交該文件並將其推送到Heroku,Heroku將安裝這些軟件包及其依賴項。
對於此特定錯誤,添加帶有django-crispy-forms
行將完成安裝。
Heroku文檔在這里
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.