2015-10-19 61 views
1

我正在嘗試配置cubesviewer並嘗試安裝。 我已經安裝了應用程序,以及立方體切片機應用程序。 然而,當我訪問主頁正確驗證的Cubesviewer配置

http://127.0.0.1:8000/cubesviewer/ 失敗彈出一個錯誤

調試與瀏覽器控制檯「同時訪問數據服務器出錯」,顯示了URL http://localhost:8000/cubesviewer/view/list/ HTTP狀態403錯誤

經過一些Google搜索和閱讀後,我想我需要添加其他框架認證設置。 (如此處所述)。

現在運行遷移和runserver後,我得到該網址上的401錯誤。

很明顯我錯過了settings.py的東西,有人可以幫我解決。 我使用github回購的cubesviewer標籤v0.10。 在這裏找到我的設置。 http://dpaste.com/2G5VB5K

P.S:我已經驗證了Cubes切片機可以獨立工作。

回答

0

我已經轉載了這個。當您使用不同的URL訪問網站並訪問相關資源時,可能會發生此錯誤。出於安全原因,瀏覽器允許從與您正在查看的頁面完全相同的主機訪問資源。

似乎您通過http://127.0.0.1:8000訪問應用程序,但您已配置CubesViewer以通過http://localhost:8000告訴客戶端訪問數據後端。雖然它是相同的IP地址,但它們是不同的字符串。

請嘗試訪問應用程序爲http://localhost:8000

如果您部署到不同的服務器,則需要調整設置。以下是相關的配置選項,現在更多的評論:

# Base Cubes Server URL. 
# Your Cubes Server needs to be running and listening on this URL, and it needs 
# to be accessible to clients of the application. 
CUBESVIEWER_CUBES_URL="http://localhost:5000" 

# CubesViewer Store backend URL. It should point to this application. 
# Note that this must match the URL that you use to access the application, 
# otherwise you may hit security issues. If you access your server 
# via http://localhost:8000, use the same here. Note that 127.0.0.1 and 
# 'localhost' are different strings for this purpose. (If you wish to accept 
# requests from different URLs, you may need to add CORS support). 
CUBESVIEWER_BACKEND_URL="http://localhost:8000/cubesviewer" 

或者,你可以改變CUBESVIEWER_BACKEND_URL"http://127.0.0.1:8000/cubesviewer"但我建議你使用主機名和這個不是IP地址。

最後,我還沒有測試CORS支持,但如果您想嘗試這種方法,請檢查this pull request

+1

啓用cors支持解決了我的問題..謝謝 –