Monday, August 30, 2010

Re: deployment problem gotcha

Graham

Thanks for your response. Everything works nice now.

I read the reference and fixed the missing slashes and commented out
print functions if dev-oriented or added the print option
file=sys.stderr if reporting an error.

Nice to learn something before it bites :)

I have decided to keep the django admin-media files untouched in-situ
because it keeps my own static files area less cluttered. It also means
less hassle for me when django tweaks admin templates, js, css and images.

I also decided to use FollowSymLinks so I could stick with the more
generic python rather than python2.6 in the path.

Thanks again

Mike


On 30/08/2010 5:36pm, Mike Dewhirst wrote:
>> I had an admin media problem finding base.css in deploying an app
>> from the Django (svn head) dev server on Windows to Apache 2.2 on
>> Linux
>>
>> Because I had prepared this email ready to ask for help, I'm
>> posting it anyway with the hope that it helps someone.
>>
>> Everything else was working. Firebug was saying it couldn't find
>> base.css and I couldn't see anything wrong with the following
>> excerpts from settings.py and vhosts.conf:
>>
>> ... from settings.py ...
>>
>> MEDIA_ROOT = '/srv/www/ccm/htdocs/static' MEDIA_URL = '/static/'
>> ADMIN_MEDIA_ROOT =
>> '/usr/local/lib64/python/site-packages/django/contrib/admin/media/'
>>
>>ADMIN_MEDIA_PREFIX = '/media/'
>>
>> ... from vhosts.conf ...
>>
>> Alias /media/
>> /usr/local/lib64/python/site-packages/django/contrib/admin/media
>
> You are missing a trailing slash on filesystem path which may be a
> cause of problems.
>
>> <Directory
>> /usr/local/lib64/python/site-packages/django/contrib/admin/media>
>> AllowOverride None Order deny,allow Allow from all </Directory>
>>
>> Alias /static/ /srv/www/ccm/htdocs/static/ Alias /tiny_mce/
>> /srv/www/ccm/htdocs/static/js/tiny_mce/ Alias /jquery/
>> /srv/www/ccm/htdocs/static/js/jquery/
>>
>> <Directory /srv/www/ccm/htdocs/> AllowOverride None Order
>> deny,allow Allow from all </Directory>
>>
>> Now, in order to get some meaningful error messages I included
>> this
>>
>> import sys sys.stdout = sys.stderr
>
> That shouldn't have made any difference because the error message is
> from Apache and not from the Python web application.
>
> That workaround to broken WSGI applications is also only need in
> mod_wsgi 2.X and earlier and not 3.X. This is because default change
> in 3.0 as gave up trying to make people write portable WSGI
> applications. Read:
>
> http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output...
>
>
>> in my wsgi script - as per the recommendation I found
>> inhttp://code.google.com/p/modwsgi/wiki/DebuggingTechniques
>>
>> and after which, I discovered "Symbolic link not allowed or link
>> target not accessible: /usr/local/lib64/python" in the Apache error
>> log. This gave the clue that I needed:
>>
>> /usr/local/lib64/python2.6/site-packages/django/contrib/admin
>>
>> rather than the one prepared earlier which incorporated /python/
>> which is a symbolic link.
>>
>> Google indicated I could have included Options FollowSymLinks and
>> maybe I should have done that instead.
>>
>> Maybe an expert who has read this far might care to comment?
>
> I would generally recommend that a copy be made of media directory
> into a sub directory of Django site and use it from there instead.
> That way you can customise them without fiddling with the originals.
>
> Graham

--
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