Let me thanks you guys at the Stack Overflow community for helping me with various Django and Apache (with mod_wsgi) errors. I\'ve asked about 5 related questions so far and
The following did the trick for me. (Django 1.11 with Python 3.6)
Alias /static/admin /usr/local/lib/python3.6/site-packages/django/contrib/admin/static/admin
<Directory "/usr/local/lib/python3.6/site-packages/django/contrib/admin/static/admin">
Require all granted
Order allow,deny
Allow from all
# AllowOverride All
</Directory>
Alias /static /var/www/app/static
Hope it helps.
I think you should change:
Alias /media/ "/usr/lib/python2.6/site-packages/django/contrib/admin/media"
to:
Alias /static/admin/ "/usr/lib/python2.6/site-packages/django/contrib/admin/media"
Because you have:
ADMIN_MEDIA_PREFIX = '/static/admin/'
I got solution, I looked at the access_log files inside /var/log/httpd/
127.0.0.1 - - [28/Dec/2013:14:49:20 -0500] "GET /static/admin/css/login.css HTTP/1.1" 200 836 "http://127.0.0.1/admin/" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111109 CentOS/3.6.24-3.el6.centos Firefox/3.6.24"
so I added following tags in /etc/httpd/conf/httpd.conf file,
Alias /static /usr/lib/python2.6/site-packages/django/contrib/admin/static
inside <VirtualHost 127.0.0.1:80>
tag
then I restarted service using
service httpd restart
and it Works!!!
That's because you haven't setup your STATIC files...
Add to settings:
STATIC_URL = '/static/'
STATIC_ROOT = '/var/www/static/'
Then run "python manage.py collectstatic"
That will put all the files under STATIC_ROOT which STATIC_URL will serve... You shouldn't point Apache at your Python lib files!!
If you want your own app-specific static files as well, setup "STATICFILES_DIRS".