On Wed, Sep 9, 2009 at 7:23 AM, Simon Lee <hago...@yahoo.com> wrote:

>
> Hi All,
>
> I am following the tutorial in the Django website (writing your first
> django app) and get it to work on the development server. However,
> when I port to Apache, the admin template is not loaded and thus I
> could not get the nice Django UI with Apache. I try copying the
> default django admin templates into my project root and add the path
> to the TEMPLATE_DIRS in settings.py but still cannot get the django UI
> in the login page and the admin dashboard.
>
> Below is my settings:
>
> OS: Fedora 11
> Apache: 2.2 with mod_wsgi
> Django: 1.1
>
> [snip]
>  Settings.py
>
> [snip]
> # URL prefix for admin media -- CSS, JavaScript and images. Make sure
> to use a
> # trailing slash.
> # Examples: "http://foo.com/media/";, "/media/".
> ADMIN_MEDIA_PREFIX = '/media/'
>
> [snip]

When I typed in http://127.0.0.1:8000/myapp/admin in the browser when
> the development server runs the code. The output is perfect.
>
> When the development server is not running and I typed in
> http://localhost/myapp/admin, it prompt me the login page but without
> all the styling as before. I can login and go to the admin dashboard
> page but again the display is not with the django admin template.
>
>
Missing styling means missing CSS, and has nothing to do with templates.
The fact that the pages are getting delivered without template not found
exceptions means there is not a problem with templates (and you should un-do
copying the admin templates into your own tree as that is likely just to
cause confusion down the road.)

You need to set up your Apache server to serve the admin media files (which
will have urls starting with ADMIN_MEDIA_PREFIX).  These are static files
and so not served by Django, except when you are running the development
server there is an admin media server that automagically serves them out of
the Django source tree.  The files are located under
django/contrib/admin/media. The doc for setting up static file serving with
mod_wsgi is here:

http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#serving-media-files

Karen

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to