Default Django 1.5 admin css not working
How did you configure it? For admin app to load static files, you need to create a symbolic link inside your app's static
directory. Have you done this?
ls -l
should give something like:
admin -> /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media
Why does my Django admin site not have styles / CSS loading?
Django does not serve static files on it's own. You have to tell it where the files are.
The ADMIN_MEDIA_PREFIX in the settings.py will point Django in the right location.
Since you're using the development version, you'll want the dev-specific document for static files how-to. Adam's link will lead you to the 1.2 version.
css doesnt work in administration page in django on aws
I had the same CSS files not found issue for admin site when following:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html#python-django-create-app
What worked for me is:
.ebextensions/django.config:
container_commands:
01_collectstatic:
command: "python manage.py collectstatic --noinput"
leader_only: true
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: ebdjango/wsgi.py
aws:elasticbeanstalk:container:python:staticfiles:
"/static": "static/"
add the following line to ebdjango/settings.py:
STATIC_ROOT=os.path.join(BASE_DIR,'static/')
then eb deploy
hope this helps
Why there is no static files(js/css/pic) in my Django(1.5.1) Admin Site?
Finally I solve this problem by myself.
The reason is not caused by Django version or settings in settings.py, but by the key(s) which is(are) not ASCII in Windows regedit.
The regedit path is HKEY_CLASSES_ROOT\MIME\Database\Content Type, find out the non-ASCII key(s)(such as Chinese keys) and delete it(them).
It works now:)
STATIC_URL Not Working on Django 1.5
OK I'm getting a 304 on the .js and .css files, so looks like I have fixed it. I just had to change my folder name from 'static' to 'staticfiles', in my inner srt_project directory. Though it doesn't makes any sense to me as to how this is possible, if 'static' is now 'staticfiles':
[29/Oct/2013 12:50:48] "GET /static/srt/css/django-admin-widgets.css HTTP/1.1" 304 0
[29/Oct/2013 12:50:48] "GET /static/srt/js/django-admin.multiselect.js HTTP/1.1" 304 0
Could someone please explain it?
Django admin media not loading
Thank you for your help, the problem was in the nginx.conf, I wasn't locating /static folder.
location /static {
root /srv/www/antingprojects.com.ar/gobras;
}
conversion from django 1.4 to 1.5 errors
so django 1.5 was giving me nightmare so i resolved my problem by using direct jquery datpicker here is the jquery datepicker
all i had to do is change the id which is a little bit tricky in django .for example if your date field name is start_date then id will be formtools_start_date . and for this kind of datepicker you don't even need any icon to show.. this helped me i hope this will help those also whoever upgraded their django version.
Django 1.5.4 unable to serve css on development server
You need to use absolute paths when defining MEDIA_ROOT, STATIC_ROOT, STATICFILES_DIRS and TEMPLATE_DIRS. Good practice is to start off settings module (it doesn't have to be a single file!) with something like this:
import os
PROJECT_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
Yeah yeah, I know how it looks, the most awful piece of Python I've encountered so far. Yet it IS a way to go. Let's check it out in a shell:
In [1]: from django.conf import settings
In [2]: settings.PROJECT_DIR
Out[2]: '/home/yourname/Projects/simple_emp_hr/simple_emp_hr/..'
Which is equivalent to /home/yourname/Projects/simple_emp_hr
right?
Now we can use os.path.join
again to glue dirs together:
In [3]: import os
In [4]: os.path.join(settings.PROJECT_DIR, 'foo', 'bar')
Out[4]: '/home/yourname/Projects/simple_emp_hr/simple_emp_hr/../foo/bar'
And here we go in the actual settings:
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static') # you will have something different, I guess
STATICFILES_DIRS = (
os.path.join(PROJECT_DIR, 'hr_base', 'static'),
)
Same drill for MEDIA_ROOT.
EDIT: my urls snippet for static. I shamelessly took it from some blog back in a day.
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# normal patterns
)
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
)
Related Topics
Bootstrap Ie Background Color Issue
Computed Width with Decimal Values in Firefox, But Without Decimals in Webkit
How to Overflow the Contents of a Column into the Next Column Using CSS
Why Do Modern Browsers Still Put Spaces Between Inline Block If There Is Whitespace
CSS - Fonts Render Differently in Firefox and Chrome
Image Button Displaying 'Submit Query' Over the Top of Image in Firefox
Box-Sizing: How to Get Rid of the Scrollbar Padding in Firefox
What Is the Scope of the * CSS Hack
Make a Div Appear on Hover Over Another Div
Is There a CSS Selector for an Img Which Has Been Constrained by Max-Width or Max-Height
Margin Behavior of "Overflow:Hidden" Div After Floating Div on Webkit
How to Render Bootstrap Dropdown Above the Object
How to Write A:Visited in Inline CSS
Stop Link's :Before Content from Being Underlined by Rule Applied to the Link