run django projact from another python program
<p>are anyway to run django project from another python program without useing subprocess or os.system.</p>

<p>im trying to use :</p>

<pre><code>os.system("python manage.py runserver")
</code></pre>

<p>and : </p>

<pre><code>subprocess.call("python", "manage.py", "runserver")
</code></pre>

<p>but i want to run it from kivy in android and android don't have python builtin</p>

<p>django local server is using as serverside of webwiew.</p>

<p>i find runpy module but it can't run django.</p>

<p>how can i do this ?</p>

<p>edit 1 :</p>

<p>i do it like that Tomasz Jakub Rup say but not work and give below error :</p>

<pre><code>    Python 3.5.1 (default, Mar  3 2016, 09:29:07) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import os
&gt;&gt;&gt; import django
&gt;&gt;&gt; os.environ['DJANGO_SETTINGS_MODULE'] = 'sample.settings'
&gt;&gt;&gt; if hasattr(django, 'setup'):
...     django.setup()
... 
&gt;&gt;&gt; from django.core.management import call_command
&gt;&gt;&gt; call_command('runserver')
/usr/bin/python: can't find '__main__' module in ''
</code></pre>

<p>First You must init <code>django</code>:</p>

<pre><code>import os

import django

os.environ['DJANGO_SETTINGS_MODULE'] = 'testapp.settings'
if hasattr(django, 'setup'):
    django.setup()

from django.core.management import call_command
</code></pre>

<p>And run command:</p>

<pre><code>call_command('runserver')
</code></pre>

android python django server kivy