如果我直接從命令行執行runserver
或gunicorn
,則該網站正常工作。但是,如果我嘗試運行gunicorn使用工頭作爲Heroku documentation規定:與工頭一起運行Gunicorn
web: gunicorn myapp.wsgi
然後我的網站的靜態文件是無法訪問突然;試圖去
http://0.0.0.0:5000/static/js/jquery-1.9.1.min.js
只給我這個錯誤消息:
Using the URLconf defined in myapp.urls, Django tried these URL patterns, in this order:
^$ [name='homepage']
...
The current URL, static/js/jquery-1.9.1.min.js, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
正如我已經說過了,靜態文件,如果在調用gunicorn絕對訪問或直接RUNSERVER,或者即使使用runserver
與foreman start
,所以我猜它沒有太多的關於我的靜態文件設置?
另外,在工頭用DEBUG = False
運行gunicorn甚至不會返回任何東西,除了500錯誤。沒有記錄,甚至沒有哨兵,所以我不知道什麼是錯的。它也可以正常使用gunicorn或runserver單獨運行,或者使用runserver與工頭。
任何想法我可以做些什麼來解決這個問題?
感謝您的猜測,但是,我沒有任何用戶上傳的文件,所以我的媒體網址是空的和未使用的。我的靜態url絕對有效,至少在直接運行gunicorn時。正如我所說的,當從領班運行gunicorn時,js文件無法訪問,但直接運行gunicorn時可以訪問。即使在主頁上也顯示500錯誤,所以我很確定它不是404錯誤... – wrongusername 2013-04-08 07:20:37