Browse Source

fix python3 compatibility problem

pull/1128/head
Liangfu Chen 3 years ago
committed by GitHub
parent
commit
aa1b9c3c6f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions
  1. 11
      app/doccano/doccano.py

11
app/doccano/doccano.py

@ -1,5 +1,6 @@
import argparse import argparse
import os import os
import sys
import subprocess import subprocess
@ -19,19 +20,19 @@ def main():
print('Setup Database.') print('Setup Database.')
base = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) base = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
manage_path = os.path.join(base, 'manage.py') manage_path = os.path.join(base, 'manage.py')
subprocess.call(['python', manage_path, 'wait_for_db'], shell=False)
subprocess.call(['python', manage_path, 'migrate'], shell=False)
subprocess.call(['python', manage_path, 'create_roles'], shell=False)
subprocess.call([sys.executable, manage_path, 'wait_for_db'], shell=False)
subprocess.call([sys.executable, manage_path, 'migrate'], shell=False)
subprocess.call([sys.executable, manage_path, 'create_roles'], shell=False)
print('Create admin user.') print('Create admin user.')
subprocess.call(['python', manage_path, 'create_admin',
subprocess.call([sys.executable, manage_path, 'create_admin',
'--username', args.username, '--username', args.username,
'--password', args.password, '--password', args.password,
'--email', args.email, '--email', args.email,
'--noinput'], shell=False) '--noinput'], shell=False)
print(f'Starting server with port {args.port}.') print(f'Starting server with port {args.port}.')
subprocess.call(['python', manage_path, 'runserver', f'0.0.0.0:{args.port}'])
subprocess.call([sys.executable, manage_path, 'runserver', f'0.0.0.0:{args.port}'])
if __name__ == '__main__': if __name__ == '__main__':

Loading…
Cancel
Save