Seafile 7.0.2, seafdav bug "No module named seahub_settings."

Hi!
I tried building Seafile Server 7.0.2 and I ran into some issues.

  1. https://github.com/haiwen/django-constance/blob/master/setup.py lists “django-picklefield” as a requirement. Unfortunately, the download from pip (v2.0) fails, something seems to be broken on their side. Is it possible to add picklefield’s version number in constance’s setup.py? Or mention it in the manual?

  2. “seafdav/wsgidav/addons/seafile/seahub_db.py” seems to require SQLalchemy at runtime. Without it, seafdav will be restarted over and over again by the controller without actually working. And worse, it doesn’t log anything to seafdav.log, making it hard to troubleshoot.
    Maybe include that dependency into the documentation as well?

  3. When SQLalchemy is installed, the seafdav.log works, it says: “Failed to init seahub db: No module named seahub_settings.” It’s imported in https://github.com/haiwen/seafdav/blob/28eb8276aa86f4b8f09c89f9d0d2ece34dc2ba31/wsgidav/addons/seafile/seahub_db.py line 24

--- seafdav/wsgidav/addons/seafile/seahub_db.py 2019-06-18 16:53:28.761890959 +0200
+++ seafdav/wsgidav/addons/seafile/seahub_db.py.new     2019-06-18 16:54:20.801890939 +0200
@@ -1,4 +1,8 @@
 from urllib import quote_plus
+import os
+import sys
+
+central_conf_dir = os.environ.get('SEAFILE_CENTRAL_CONF_DIR', '')

 from sqlalchemy import create_engine
 from sqlalchemy.event import contains as has_event_listener, listen as add_event_listener
@@ -24,7 +28,13 @@
         return None

 def create_seahub_db_engine():
-    import seahub_settings
+    try:
+        if os.path.exists(central_conf_dir):
+            sys.path.insert(0, central_conf_dir)
+        import seahub_settings
+    except ImportError:
+        pass
+    #import seahub_settings
     db_infos = seahub_settings.DATABASES['default']
     #import local_settings
     #db_infos = local_settings.DATABASES['default']

I’m not sure if this is the right way to deal with the problem, the code is copied from seahub’s settings.py. Also, I didn’t look into the sqlite-part of that code since I don’t use sqlite.
Shouldn’t seafdav be started by seahub somehow, thus not requiring to load conf/seahub_settings.py at all? Maybe I’m still missing a dependency?

On a side note: when I patched seafdav and then build the server using “seafile-server/scripts/build/build-server.py”, the patch gets removed. So I had to re-apply it in seafile-server-7.0.2/seahub/thirdpart/wsgidav/addons/seafile/seahub_db.py. Is that a mistake or by design? And how to avoid it?

Any thoughts or explainations are highly welcome, especially on #3.
It seems to work fine (test szenario).

2 Likes

Hi,

Same for me about the “Init seahub database… Failed to init seahub db: No module named seahub_settings.” error. But I don’t have SQLalchemy.

Okay, I’ve had time to test this against the prebuild binary (https://download.seadrive.org/seafile-server_7.0.2_x86-64.tar.gz) from the download section.
seafdav.log also says “Failed to init seahub db: No module named seahub_settings.” here.
Adding the code from my fist post to seahub/thirdpart/wsgidav/addons/seafile/seahub_db.py also makes that error go away and SeafDAV works.

@Jeff_Jeff did you install the prebuild binary or a self-compiled version? Can you test if the modifications above fixes seahub’s issues for you as well? (Please don’t try that on a production server)

Hi,

Thanks for your return. I’ve installed the official package on a debian server. Updated from version 6.0.9 (by following the instructions as well).
Your modifications didn’t work for me (after restarting, of course). Same error again. I don’t know what to try!

Same problem with 7.0.3 server. @dennis modification fixes error in log, but webdav still does not work, there is HTTP 500 error.

[2019-08-06 23:12:53,304]: Init seahub database…
[2019-08-06 23:12:53,307]: Failed to init seahub db: No module named seahub_settings.
me too