开发者

cannot install django-filebrowser app

开发者 https://www.devze.com 2023-04-08 09:26 出处:网络
I did exactly as it says here: http://readthedocs.org/docs/django-filebrowser/en/latest/quickstart.html#quickstart (only used easy_install instead of pip)

I did exactly as it says here: http://readthedocs.org/docs/django-filebrowser/en/latest/quickstart.html#quickstart (only used easy_install instead of pip)

it seems that I get an import error when trying to connect to admin interface:

Request Method:     GET
Request URL:    http://localhost:8000/admin/
Django Version:     1.3
Exception Type:     ImportError
E开发者_如何学Cxception Value:    

No module named sites

Exception Location:     c:\workspace\expedeat\..\expedeat\urls.py in <module>, line 5
Python Executable:  c:\Tools\Python26\python.exe
Python Version:     2.6.4

the import the exception comes from is: from filebrowser.sites import site in urls.py

Also testing filebrowser fails with this message:

Creating test database for alias 'default'...
.......F......
======================================================================
FAIL: test_directory (filebrowser.tests.settings.SettingsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\Tools\Python26\lib\site-packages\django_filebrowser-3.3.0-py2.6.egg\filebrowser\tests\set
tings.py", line 29, in test_directory
    self.assertEqual(os.path.exists(os.path.join(MEDIA_ROOT,DIRECTORY)), 1)
AssertionError: False != 1

----------------------------------------------------------------------
Ran 14 tests in 0.008s

FAILED (failures=1)
Destroying test database for alias 'default'...

I must be doing something wrong. Any help would be appreciated.


the sites.py module does not exist in version you are using, so the error message is correct.

the installation doc you are using is for version 3.4. The pip install is 3.3. The difference being in the urls.py

3.4

from filebrowser.sites import site
urlpatterns = patterns('',
   url(r'^admin/filebrowser/', include(site.urls)),
)

3.3

urlpatterns = patterns('',
    (r'^admin/filebrowser/', include('filebrowser.urls')),
)


The test fails because it's looking for a non-existing directory.

To find out what directory it's looking for, do the following:

% python ./manage.py shell 
>>> from django.conf import settings 
>>> import filebrowser.settings 
>>> filebrowser.settings.MEDIA_ROOT
'/srv/repositories/project/media'
>>> filebrowser.settings.DIRECTORY 
'uploads/'

Based on the output, you know what directory it's looking for, /srv/repositories/project/media/uploads in this example. Create the directory and you should be one step further on your way.


Using the "FILEBROWSER_" prefix, you can supply configuration for the filebrowser app.

I use the following in my settings.py :

FILEBROWSER_DIRECTORY = MEDIA_ROOT
0

精彩评论

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