29đź‘Ť
âś…
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/'
👤jpic
18đź‘Ť
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”.
👤romemmy
- [Django]-Altering database tables in Django
- [Django]-Django 1.5 – How to use variables inside static tag
- [Django]-Cannot import name _uuid_generate_random in heroku django
3đź‘Ť
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!!!
👤Mahesh Shitole
- [Django]-Is Tornado a replacement to Django or are they complementary to each other?
- [Django]-In django, how do I sort a model on a field and then get the last item?
- [Django]-Django: best practice for splitting up project into apps
0đź‘Ť
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.
👤Ashwin
- [Django]-Dropdown in Django Model
- [Django]-What is more efficient .objects.filter().exists() or get() wrapped on a try
- [Django]-Naming Python loggers
Source:stackexchange.com