Django python can't set the admin default design to my interface
I have tried Django for a few days, and I'm trying to set up a production project with apache. I have followed the official tutorial at
http://docs.djangoproject.com/en/1.3/intro/tutorial01/
Everything works just fine with the development server but with apache, I lose every admin style.
I have read similar posts for this issue, without any success from now.
Django admin has no style Django: ugly admin interface
It may be a rights issue, but I have copied the directory where the media files are stored
/usr/share/pyshared/django/contrib/admin/media/
to the site I server under /data
/data/mysite/ /data/media/ /data/templates/
I have tried different values for /data/mysite/settings.py
/media/, /data/media/,
with the Alias item in the apache configuration as well.
Here is my apache configuration ` ServerAdmin webmaster@localhost
DocumentRoot /data/sites/accounts/
Alias /media/ /usr/share/pyshared/django/contrib/admin/media/
<Directory />
Options None
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Location />
SetHa开发者_JAVA百科ndler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE accounts.settings
PythonDebug On
PythonPath "['/data/sites/accounts', '/data/sites/accounts/unix_accounts', '/data/sites', '/usr/lib/pymodules/python2.6/django'] + sys.path"
</Location>
LogLevel warn
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
`
I have the intuition that this is a right issue, but /data/media/ and /data/templates have the same rights/owner and I can modify any template without any problem, and still no style for admin. Each file served by apache belongs to root:www-data, and 750 for the files, 710 for dirs.
I really thank any of you for any idea helping me to solve this issue :)
EDIT: I have used for apache the module mod_python. Don't hesitate to ask for any further details
Thx a lot!
This is definitely an Apache issue. Your Alias is outside of your DocumentRoot, but you're not specifying access to it:
http://httpd.apache.org/docs/2.0/mod/mod_alias.html#alias
P.S.: If you don't use a tool like Firebug, you could enter the URL of let's say one of the admin css files, to see in your browser what the response is (that's at least more info than "no styles").
I finally have solved this issue!
I have spend some time on it, looking on django book and stuff, but I discovered the solution at this link:
Solution_StackOverflow
This then gives my apache configuration file:
Alias /media/css /data/media/css
<Directory /data/media/css>
Order Allow,Deny
Allow from all
</Directory>
<Directory />
Options FollowSymlinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Location /admin/>
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE accounts.settings
PythonDebug On
PythonPath "['/data/sites/accounts', '/data/sites/accounts/unix_accounts', '/data/sites', '/usr/lib/pymodules/python2.6/django'] + sys.path"
</Location>
I have copied media files at /data/media
I hope this could help someone having the same trouble.
Thanks a lot for your help!
精彩评论