Задать вопрос

Тел: +7 965 3737 888

471

Просмотров

1

Ответов

staticview for app

<p>This module is comes from the original staticview.py from django. But when you using it, it can looks for static files in your app's subdirectory. So that you can put static files which concerned with your app in a subdirectory of the app. I should say it method only suit for developing, so if you want to deploy your application to apache, you should copy static folder to the real media folder. And if you keep the same structure of the directory, then it'll be very easy. And you can write a little script to automatically do that. But for now, I didn't have written one yet :P</p>
<h2>How to use it in urls.py</h2>
<p>Here's an example:</p>
(r'^site_media/(.*)$', 'utils.staticview.serve', {'document_root': settings.SITE_MEDIA, 'app_media_folder':'media'}),

<p>It seems just like the original one in django. But there is a new parameter "app_media_folder", it's used for subdirectory name of app. So your django project folder structure maybe seem like this:</p>
/yourproject
    /apps
        /appone
            /media
                /css
                /img
                /js
    /media
        /css
        /img
        /js

Вопрос полезен? Да0/Нет0
file_4244.py(5.3Кб)
None

Ответы (1):

Ответgabamnml:05.06.2012
Ответ полезен? Да0/Нет0

yeah! thx is work perfect