0

I tried to run this command by os.system, this command should run a virtual environment first then, it will run the Django server:

import os


os.system('''
.\\match_pyinstaller\match_project\\venv\\Scripts\\activate
python .\match_pyinstaller\match_project\manage.py runserver
''')

what is happening is that the command runs with no error raised "Process finished with exit code 0"

to ensure that the command works properly, I removed the first line that refers to Venv and tried to run the command again and it traced back by "No Module Name ...." which means that it works fine however, the server doesn't open so, why?

Abdelhamed Abdin
  • 556
  • 1
  • 6
  • 19

1 Answers1

0

Command: os.system('Echo "Hi There, you can use an && or : (in linux) to perform multiple commands in os.system() method as i did here" && dir')

Result: "Hi There, you can use an && or : (in linux) to perform multiple commands in os.system() method as i did here" Volume in drive C has no label. Volume Serial Number is 2280-5031

Directory of C:\Users\gettv\AppData\Local\Programs\Python\Python310.....

BugsNRoses
  • 11
  • 4
  • I don't understand what you mean by your answer. I think you are talking about the different commands between Linux and Windows while I'm asking about running the server in Django using its virtual-environment this is my question. I'm not saying that there's a raising error happening instead, I say that there's no issue happening however, the server doesn't work over there – Abdelhamed Abdin Oct 24 '22 at 14:05
  • You can combine commands to run on os.sytem(''), just like combining commands in a terminal or a command prompt, refer https://stackoverflow.com/questions/8055371/how-do-i-run-two-commands-in-one-line-in-windows-cmd – BugsNRoses Oct 24 '22 at 19:50