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>Built in development server of django is fine initially but down the line you might want to use uwsgi or gunicorn to serve your application. They are efficient and can also be made to run on startup in the background rather than launching the shell and you having to run the command manually. You can check more about it here.</p>

<p><a href="http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html" rel="nofollow">http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html</a></p>

android python django server kivy