On 31 March 2013 21:21, Avnesh Shakya <[email protected]> wrote:

> hi,
>      I am using virtualenv for django project, and I have installed
> apache2 and wsgi for project...., but when i am trying to run it on
> browser, then it's not displaying... it's downloading it.....
> http://localhost/mydomain.com/index.wsgi
> it's downloading it.... not displaying.... please help me...
>
> my pages-
> /var/www/mydomain.com/index.wsgi <http://mydomain.com/index.py>
> **
>
> import os
> import sys
> import site
>
> # Add the site-packages of the chosen virtualenv to work with
> site.addsitedir('~/.**virtualenvs/DJ/local/lib/**python2.7/site-packages')
>
> # Add the app's directory to the PYTHONPATH
> sys.path.append('/home/**avnProject/avnProject')
> sys.path.append('/home/**avnProject/avnapp')
>
> os.environ['DJANGO_SETTINGS_**MODULE'] = 'avnProject.settings'
>

This is possibly wrong. What is the full path to your Django settings file
and which version of Django are you using?


> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.**WSGIHandler()
>
> AND
> second file is-- path
> /etc/apache2/sites-available/m**ydomain.com <http://mydomain.com>
>
> <VirtualHost *:80>
>     ServerAdmin [email protected]
>     ServerName localhost
>     ServerAlias mydomain.com
>     WSGIScriptAlias / 
> var/www/mydomain.com/index.**wsgi<http://mydomain.com/index.wsgi>
>

This should be:

WSGIScriptAlias /
/var/www/mydomain.com/index.**wsgi<http://mydomain.com/index.wsgi>


>
>
>     Alias /static/ /var/www/mydomain.com/static/
>     <Location "/static/">
>         Options -Indexes
>     </Location >
> </VirtualHost >
>
> Myproject directory is ---- /home/avin/avnProject/
>
> please help me....
> i m trying localhost/mydomain.com then fine when I put localhost/
> mydomain.com/index.**wsgi,then <http://mydomain.com/index.wsgi,then> it's
> downloading it......
> and i m unable to open admin page here
>

Which suggests your VirtualHost is being ignored and that you have
DocumentRoot set elsewhere in your Apache configuration to be /var/www.

It is not enough to just stick a file in sites-available. Depending on
Linux variant you also have to then symlink that into sites-enabled or run
a2ensite which will do that for you. Go read your Linux documentation about
enabling sites in Apache.

When you get the VirtualHost worked out, the URL would be just:

http://mydomain.com

for the root of the site.

The file 'index.wsgi' should never appear in the URL.

I would also not put the WSGI file under DocumentRoot for the whole Apache
server either as you appear to be.

You should perhaps use Django 1.5 and use the wsgi.py file it generates
when you run startproject and set the Apache configuration as defined in:

https://docs.djangoproject.com/en/1.5/howto/deployment/wsgi/modwsgi/

Graham


> Thanks in advance.......
>
>  --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to