django static資料夾下面的內容方法不了出現404 500錯誤
需要查看自己的settings檔案確保有一下內容
import os PROJECT_ROOT = os.path.dirname(__file__) DEBUG = True STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(PROJECT_ROOT, 'static'), ) STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', )
<VirtualHost *:80> ServerName www.mydjangosite.com ServerAlias mydjangosite.com ServerAdmin fake@mydjangosite.com DocumentRoot /path/to/mydjangosite <Directory /path/to/mydjangosite> Options FollowSymLinks AllowOverride None Order allow,deny allow from all </Directory> Alias /static/ /path/to/mydjangosite/static/ <Directory /path/to/mydjangosite/static> Order allow,deny allow from all </Directory> # The following installs the Django WSGI app WSGIDaemonProcess www.mydjangosite.com processes=2 threads=15 display-name=%{GROUP} WSGIProcessGroup www.mydjangosite.com WSGIScriptAlias / /path/to/mydjangosite/wsgi.py </VirtualHost>
<ango如果有一下內容
rrreee35ango 如果要等於True 靜態檔案才能存取?這一點不太明白如果需要部署到web站點上需要在apache中配置靜態文件映射🎜🎜🎜rrreee🎜🎜🎜感謝閱讀,希望能幫助大家,謝謝大家對本站的支持! 🎜🎜更多python django 訪問靜態檔案出現404或500錯誤相關文章請關注PHP中文網! 🎜