I want to run a python scripts which should do:
- Create a django project:
django-admin startproject foobar - Create a app in the project:
python manage.py barfoo - Add an entry of newly created app
barfooin the setting’sINSTALLED_APP.
How can I achieve this?
Read a little abour subprocess and Popen method. This might be what you’re looking for.
Popen(["django-admin", "startproject", "%s" % your_name ], stdout=PIPE).communicate()Popen(["python", "manage.py", "%s" % your_app_name ], stdout=PIPE).communicate()3.
I know that’s not a perfect code, but I’m just giving an idea.