I am trying to access django project (mysite) on my android virtual device. Content of /var/www/mysite/apache django.wsgi file is:
import os
import sys
from django.conf.urls.defaults import *
sys.path.insert(0, '/var/www')
sys.path.insert(1,'/var/www/mysite')
sys.path.insert(1,'/var/www/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
My /etc/apache2/httpd.conf file:
MaxRequestsPerChild 1
ServerName localhost
PythonPath "['/var/www','/var/www/mysite','/var/www/mysite/books','/var/www/templates'] + sys.path"
DocumentRoot /var/www/mysite
<Location "/mysite/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
</Location>
My /etc/apache2/sites-available/localhost file:
<Virtualhost 192.168.1.2:80>
ServerName localhost
DocumentRoot /var/www/mysite
<Directory /var/www/mysite>
Order allow,deny
Allow from all
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
</Directory>
WSGIDaemonProcess mysite processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/mysite/apache/django.wsgi
</Virtualhost>
Now when I try to access url="http://192.168.1.2/mysite/login" in android avd it is giving me the following error:
"error Cannot connect to destination (192.168.1.2)"
I am able to access the site by typing "http://localhost/mysite/login" in browser but not in android avd.
Can anyone help me here please?
Host computer (the one running the emulator) is available on the virtual Android device using 10.0.2.2 IP and not using the actual IP of the PC.
See the emulator networking reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With