summarylogtreecommitdiffstats
path: root/fix_seafile-admin.diff
blob: 42a29646ff72554109a6855c80e8d5ccf6722f36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff --git a/tools/seafile-admin b/tools/seafile-admin
index 5e3658b..90c68a8 100755
--- a/tools/seafile-admin
+++ b/tools/seafile-admin
@@ -44,7 +44,7 @@ SEAHUB_DOWNLOAD_URL = 'https://seafile.com.cn/downloads/seahub-latest.tar.gz'
 cwd = os.getcwd()
 SCRIPT_NAME = os.path.basename(sys.argv[0])
 
-PYTHON = sys.executable
+PYTHON = '/usr/lib/seahub/bin/python2.7'
 
 conf = {}
 CONF_SERVER_NAME = 'server_name'
@@ -499,7 +499,7 @@ def init_seahub():
     # create seahub_settings.py
     create_seahub_settings_py()
 
-    argv = [PYTHON, 'manage.py', 'syncdb']
+    argv = [PYTHON, 'manage.py', 'migrate']
     # Set proper PYTHONPATH before run django syncdb command
     env = get_seahub_env()
 
@@ -518,10 +518,10 @@ def init_seahub():
 
 
 def check_django_version():
-    '''Requires django 1.8'''
+    '''Requires django 1.11'''
     import django
-    if django.VERSION[0] != 1 or django.VERSION[1] != 8:
-        error('Django 1.8 is required')
+    if django.VERSION[0] != 1 or django.VERSION[1] != 11:
+        error('Django 1.11 is required')
     del django
 
 
@@ -683,7 +683,7 @@ def start_controller():
 
 def start_seahub_gunicorn():
     argv = [
-        'gunicorn',
+        '/usr/lib/seahub/bin/gunicorn',
         'seahub.wsgi:application',
         '-c',
         conf[CONF_SEAHUB_CONF],
@@ -861,6 +861,13 @@ def check_necessary_files():
         os.path.join(cwd, 'conf', 'seahub_settings.py'),
     ]
 
+    # seahub.db isn't create with a MySQL installation and crash the startup
+    with open(files[3], 'r') as f:
+        for line in f:
+            if 'DATABASES' in line:
+                del(files[2])
+                break
+
     for fpath in files:
         if not os.path.exists(fpath):
             error('%s not found' % fpath)