0
我在客戶端的網站上部署Django應用程序,並沒有直接訪問httpd.conf文件。網站支持爲我創建了以下內容,但似乎沒有STATIC_ROOT和STATIC_URL的組合,我可以使用它。它甚至有可能嗎?這些VirtualHost設置是否可以與Django一起使用?
注意:Django/Python頁面在subdomain.mywebsite.com上的服務很好 - 我只是缺少靜態文件。 (對不起,混淆的網址和IP地址...客戶端是非常私人的。)
更新1(結尾的斜槓刪除 - 仍然無法正常工作)
NameVirtualHost ##.###.###.#
<VirtualHost ##.###.###.#>
DocumentRoot /home/httpd/html/subdomain.mywebsite.com/public_html
ScriptAlias /cgi-bin /home/httpd/html/subdomain.mywebsite.com/cgi-bin
ServerName www.subdomain.mywebsite.com
CustomLog /home/httpd/logs/subdomain.mywebsite.com_access_log combined
ServerAlias subdomain.mywebsite.com
Alias /static/ /home/httpd/html/subdomain.mywebsite.com/public_html/static/
<Directory /home/httpd/html/subdomain.mywebsite.com/public_html/>
allow from all
</Directory>
<Directory /home/httpd/html/subdomain.mywebsite.com/public_html/>
<Files wsgi.py>
allow from all
</Files>
</Directory>
ProxyPreserveHost On
ProxyPass/http://127.0.0.1:8000/
ProxyPassReverse/http://127.0.0.1:8000/
</VirtualHost>
這裏就是在我的settings.py文件
STATIC_URL = '/static/'
STATIC_ROOT = '/home/httpd/html/notices.removeyourcontent.com/public_html'
我也試過:
STATIC_ROOT = '/home/httpd/html/notices.removeyourcontent.com/public_html/static'
謝謝你的建議。試着現在......最初刪除了兩個斜線,這不是你所建議的。 – evan
@evan做到了嗎? – Aki003
你的建議可能有幫助,但ProxyPass系列仍然阻止它的工作。主機上的某個人最終意識到並刪除了該行。再次感謝您的建議! – evan