Calling Python Django File in Android Java Code
<p>I'm developing an android app in Java. I was using a php file to interact w/ the database, but I want to use Python Django instead of php. Could I call the python file that interacts with the database in the same way that I called the php file?</p>

<pre><code>URL url = new URL("http://10.0.3.2/MYCODE/app/login.php");

String urlParams = "name="+name+"&amp;password="+password;

HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoOutput(true);
OutputStream os = httpURLConnection.getOutputStream();
os.write(urlParams.getBytes());
os.flush();
os.close();
</code></pre>

<p>Another more general question is how do I API Java and Python Django?</p>

<p>You could run a python socket server and interface with that using your app.  There are many ways to do this though.  I created a very small python socket server <a href="https://github.com/rstims/lightweight-python-socket-server" rel="nofollow">here</a>, you're welcome to use it, of course.</p>

<p><a href="http://www.oracle.com/technetwork/java/socket-140484.html" rel="nofollow">Java Socket Documentation</a></p>

php android python django