开发者

how using django-filebrowser at apache?

开发者 https://www.devze.com 2023-02-10 00:56 出处:网络
hi all: I have a quirky question about django-filebrowser, my project at /home/q/django/myapp, I save the django-filebrowser at /home/q/django/myapp/filebrowser .

hi all: I have a quirky question about django-filebrowser,


my project at /home/q/django/myapp, I save the django-filebrowser at /home/q/django/myapp/filebrowser .

 **myapp.settings.py**
  INSTALLED_APPS=(
    .....
    myapp.filebrowser,
    ....

 )   
  **myapp.urls.py**
   urlpatterns=patterns('',
    (r'filebrowser/',(include("filebrowser.usls")),
    ....
   )

everything is look like the tutorials http://code.google.com/p/django-filebrowser/wiki/installationbasic .

but it's not work.when I saved the django-filebrowser to django's directory:/usr/local/lib/python2.6/.... it's work fine.

so,if I want modify some settings,I need change the filebrowser.settings.py at the django root directory(/usr/local/lib/...),not my project directory(/home/q/django/myapp/filebrowser)

开发者_如何学编程

I think its not advisable.someone could get me any advice? &_& THKS

my os:ubuntu 10.04
django version :1.24
grappelli:3.X
python version:2.6(own system)
web server:apache+mod_python


You can modify all the settings, including those of django-filebrowser, in myapp.settings. The settings.py in filebrowser are the default values used if you don't specify them in your own settings. This is a widely used pattern for 3rd party django apps to define default values for settings.

If you look at filebrowser.settings, you'll see this line almost at the top:

from django.conf import settings

That line imports Django's settings module, which contains Django's default settings, overridden by the settings you defined in myapp.settings.

Further down in filebrowser.settings, there are lines like

DIRECTORY = getattr(settings, "FILEBROWSER_DIRECTORY", 'uploads/')

This assigns the value myapp.settings.FILEBROWSER_DIRECTORY to DIRECTORY, or, if you haven't defined that setting, the default value 'uploads/'.

BTW: I would avoid mod_python like the plague. It's unsupported, unmaintained and generally a pain. There's a much better alternative: mod_wsgi

0

精彩评论

暂无评论...
验证码 换一张
取 消