Friday, October 1, 2010

Re: With apache2 and mod_python I can't get static files loading in admin

On Oct 1, 12:46 pm, Karim Gorjux <lemieli...@gmail.com> wrote:
> Hi all! I just configured apache2 with mod_python to develop my site
> and work on it without runserver. The views I develop are without css
> so I didn't test it, but the admin I can't get it work properly. I
> read about static files on django site but nothing. Here my config.
> Please help me to understand where I'm wrong!
>
> Apache Settings:
>
> <Location "/">
>     SetHandler python-program
>     PythonHandler django.core.handlers.modpython
>     PythonPath "['/home/karim/Dropbox/Projects','/home/karim/Dropbox/Projects/hello']
> + sys.path"
>     SetEnv DJANGO_SETTINGS_MODULE hello.settings
>     PythonDebug On
> </Location>
>
> <Location "/static-admin">
>     SetHandler None
> </Location>
> <Location "/static">
>     SetHandler None
> </Location>
>
> My settings:
>
>    1. >>> from django.conf import settings
>    2. >>> settings.MEDIA_URL
>    3. '/static/'
>    4. >>> settings.ADMIN_MEDIA_PREFIX
>    5. '/static-admin/'
>    6. >>> settings.MEDIA_ROOT
>    7. '/home/karim/Dropbox/Projects/hello/static/'
>
> The source html in the browser on the admin page: (just the beginning)
>
>    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>    2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>    3. <html xmlns="http://www.w3.org/1999/xhtml" lang="it-it"
> xml:lang="it-it" >
>    4. <head>
>    5. <title>Amministrazione sito | Amministrazione sito Django</title>
>    6. <link rel="stylesheet" type="text/css"
> href="/static-admin/css/base.css" />
>    7. <link rel="stylesheet" type="text/css"
> href="/static-admin/css/dashboard.css" />
>    8. <!--[if lte IE 7]><link rel="stylesheet" type="text/css"
>    9. href="/static-admin/css/ie.css" /><![endif]-->
>   10.
>   11. <script type="text/javascript">window.__admin_media_prefix__ =
>   12. "/static\u002Dadmin/";</script>
>
> The files in the dir are ok:
>
>    1. karim@angus:~/Dropbox/Projects/hello$ pwd
>    2. /home/karim/Dropbox/Projects/hello
>    3. karim@angus:~/Dropbox/Projects/hello$ ls -l static-admin/css/*
>    4. -rw-r--r-- 1 karim karim 12486 2010-09-30 19:34
> static-admin/css/base.css
>    5. -rw-r--r-- 1 karim karim  5105 2010-09-30 19:34
> static-admin/css/changelists.css
>    6. -rw-r--r-- 1 karim karim   329 2010-09-30 19:34
> static-admin/css/dashboard.css
>    7. -rw-r--r-- 1 karim karim  5721 2010-09-30 19:34
> static-admin/css/forms.css
>    8. -rw-r--r-- 1 karim karim   963 2010-09-30 19:34 static-admin/css/ie.css
>    9. -rw-r--r-- 1 karim karim   780 2010-09-30 19:34
> static-admin/css/login.css
>   10. -rw-r--r-- 1 karim karim  3306 2010-09-30 19:34 static-admin/css/rtl.css
>   11. -rw-r--r-- 1 karim karim  9009 2010-09-30 19:34
> static-admin/css/widgets.css
>
> --
> K.
> Blog Personale:http://www.karimblog.net

You don't seem to have anything in your Apache configuration to tell
it that static-admin lives under ~/Dropbox/Projects/hello. Either use
a DocumentRoot directive, or symlink the static-admin directory to the
existing DocumentRoot.

Also, although it's not related to this problem, you should be using
mod_wsgi rather than mod_python.
--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment