title: How to execute manage.py from the Python shell
body: <p>I'm trying to use Werkzeug in my Django project, which essentially is a web-page Python shell interface. I want to run commands such as <code>python manage.py syncdb</code> and <code>python manage.py migrate</code> but in the Python shell it isn't very straightforward.</p>
  
  <p>I tried <code>import manage</code> and attempting commands from there, but from the looks of the source of manage.py, there's nothing to call, as it passes arguments to <code>django.core.management.execute_from_command_line()</code>.</p>
  
  <p>I also tried defining a function as shown "<a href="https://stackoverflow.com/questions/4760215/running-shell-command-from-python-and-capturing-the-output">Running shell command from Python and capturing the output</a>", but calling it using</p>
  
  <pre><code>runProcess('Python manage.py syncdb')
  </code></pre>
  
  <p>returns only:</p>
  
  <pre><code>&lt;generator object runProcess at 0x000000000520D4C8&gt;
  </code></pre>