因此,我試圖學習django以及嘗試通過mod_wsgi
在Apache服務器上創建Angular和Django REST後端的應用程序。目前,我遇到了靜態文件的問題。 Everyhing是確定當應用程序使用Django工具運行在127.0.0.1:8000
,但是當我通過Apache加載它 - 我缺少靜,所以輸出看上去很原始:無法加載靜態,Apache上的Django rest_framework,Windows
我試圖收集與靜manage.py collectstatics
,試圖定義與蟒蛇迪爾斯靜一個目錄 - 什麼都沒有:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'DjangoApp/static/')
STATICFILES_DIRS = [
'C:/Users/<user>/AppData/Local/Programs/Python/Python36-32/Lib/site-packages/rest_framework/static',
]
的Apache虛擬主機設置:
<VirtualHost 127.0.0.1:8081>
##ServerAdmin [email protected]
WSGIScriptAlias/"D:/genesi5/Coding/www/django/wsgi_handler.wsgi"
DocumentRoot "D:/genesi5/Coding/www/django"
ServerName DjangoApp
ServerAlias DjangoApp
ErrorLog "logs/myapp/error.log"
CustomLog "logs/myapp/access.log" common
<Directory "D:/genesi5/Coding/www/django">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
httpd.conf:
LoadModule wsgi_module "C:/Users/Genesi5/AppData/Local/Programs/Python/Python36-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd"
<IfModule wsgi_module>
LoadFile "C:/Users/Genesi5/AppData/Local/Programs/Python/Python36-32/python36.dll"
WSGIPythonHome "C:/Users/Genesi5/AppData/Local/Programs/Python/Python36-32"
WSGIPassAuthorization On
</IfModule>
你能提出一個解決方案嗎?
你的Apache配置是什麼樣的? –
@DanielRoseman更新 – genesi5
好吧,你似乎沒有做任何事情來通過Apache爲你的資產提供服務。 –