Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file. [RSS Feed]

#1 Dec. 11, 2010 20:14:06

j.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


Apache & mod_wsgi are configured correctly (I've created a hello
world .html apache file and a hello world mod_wsgi application with
no
problems). I know need my Django app to recognize my django.wsgi
file.
What makes me think that it's not recognizing my wsgi file is that I
went into my django.wsgi file I created and completely deleted all of
the code in the file and restarted Apache and it still gives me the
same page (a listing of the files from Django app, not my actual
Django application. Configuring Apache and mod_wsgi went really well
but I'm at a loss of how to fix this. Here are some details instead of
"it's
not working":

Here is my current django.wsgi file:

import os
import sys
sys.path.append('/srv/www/duckling.org/store/')
os.environ = '/srv/www/duckling.org/
store/.python-
egg'
os.environ = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I've tried a few different versions of the django.wsgi file
(including
a version like the one over athttp://www.djangoproject.com/).
This version of my wsgi is from here:http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10...


Also, here is my vhost apache configuration file below. I think these
are
the main files that are suppose to do the job for me. Let me know if
you see any errors in what I'm doing and what else I might do to fix
this. The django app runs fine on the django's built-in development
server so I'm thinking it *might have* something with my paths.
No errors in my apache error.log file as well. It's acting as there's
no problem at all, which is not the case...the project isn't loading,
like I said just a listing of my files and directories of my Django
project. Here is my apache config file:

<VirtualHost 1.2.3.4:80>
ServerAdmin h...@duckling.org
ServerName duckling.org
ServerAlias www.duckling.org

DocumentRoot /srv/www/duckling.org/store/

<Directory /srv/www/duckling.org/store/>
Order Allow,Deny
Allow from all
</Directory>

WSGIScriptAlias /django /srv/www/duckling.org/store/wsgi-scripts/
django.wsgi
<Directory /srv/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


And here are versions of the stack that I'm using, I saw over at the
mod_wsgi site that you all would like the versions of what I'm using
on the server:
Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch
mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8

thanks,
j.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 11, 2010 22:29:24

Mike D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


On 12/12/2010 7:14am, jc wrote:Apache& mod_wsgi are configured correctly (I've created a hello
world .html apache file and a hello world mod_wsgi application with
no
problems). I know need my Django app to recognize my django.wsgi
file.
What makes me think that it's not recognizing my wsgi file is that I
went into my django.wsgi file I created and completely deleted all of
the code in the file and restarted Apache and it still gives me the
same page (a listing of the files from Django app, not my actual
Django application. Configuring Apache and mod_wsgi went really well
but I'm at a loss of how to fix this. Here are some details instead of
"it's
not working":You are correct. Apache is not looking at the wsgi script. Have a lookat the suggestions below ... before playing with django.wsgi.Here is my current django.wsgi file:

import os
import sys
sys.path.append('/srv/www/duckling.org/store/')
os.environ = '/srv/www/duckling.org/
store/.python-
egg'
os.environ = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I've tried a few different versions of the django.wsgi file
(including
a version like the one over athttp://www.djangoproject.com/).
This version of my wsgi is from here:http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10...


Also, here is my vhost apache configuration file below. I think these
are
the main files that are suppose to do the job for me. Let me know if
you see any errors in what I'm doing and what else I might do to fix
this. The django app runs fine on the django's built-in development
server so I'm thinking it *might have* something with my paths.
No errors in my apache error.log file as well. It's acting as there's
no problem at all, which is not the case...the project isn't loading,
like I said just a listing of my files and directories of my Django
project. Here is my apache config file:

<VirtualHost 1.2.3.4:80>
ServerAdmin h...@duckling.org
ServerName duckling.org
ServerAlias www.duckling.org

DocumentRoot /srv/www/duckling.org/store/# DocumentRoot is where you keep non-django stuff eg., static files
# which is served by Apache without needing your Django code
DocumentRoot /srv/www/duckling.org/htdocs/<Directory /srv/www/duckling.org/store/>
Order Allow,Deny
Allow from all
</Directory># now let the public access anything here
<Directory /srv/www/duckling.org/htdocs/>
AllowOverride None
Order deny,allow
Allow from all
</Directory>WSGIScriptAlias /django /srv/www/duckling.org/store/wsgi-scripts/
django.wsgi
<Directory /srv/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>Somewhere in your Apache config you have denied access to the entirefilesystem to prevent outsiders from hacking in. Your Django code mustalso be hidden from outsiders so it will live safely in/srv/www/duckling.org/store because you haven't allowed anyone exceptApache to see it.Now you need to provide an allowed conduit to your Django code. So makean Apache script alias to map the website root (ie '/') to your Djangocode. Because you are using mod_wsgi the entry point is your django.wsgiscript. So map / to the script:WSGIScriptAlias / /srv/www/duckling.org/store/wsgi-scripts/django.wsgi

# and give the public full access - but only to the entry point
<Directory /srv/www/duckling.org/store/wsgi-scripts/>
Order deny,allow
Allow from all
</Directory>

hth
MikeAnd here are versions of the stack that I'm using, I saw over at the
mod_wsgi site that you all would like the versions of what I'm using
on the server:
Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch
mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8I would remove mod_python if possiblethanks,
j.--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 11, 2010 23:35:56

j.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


You definitely lost me in some places but you've also cleared some
things up in the process. I also noticed that I had "<Directory /srv/
www/wsgi-scripts>", which is lacking a directory for the
WSGIScriptAlias. I've fixed that now. *Now*, I no longer get my
listing of my files in my project when I go to my address *but* I now
get 500 Internal Server Error. I'm not sure if I should trust the logs
or maybe I've misconfigured something else (either in Apache or in my
django.wsgi file)...I had this same issue yesterday 500 error...

Also, when you said "Somewhere in your Apache config you have denied
access to the entire filesystem", do you mean *Apache* has done this
so that it will keep others out of my project (not that I've actually
done this somewhere, right?)

After these changes, the project is still not running and I'm still
not sure if it's my django app that's the issue or wsgi and my Apache
configs. :/

thanks for the reply back, I do appreciate it...

j.

On Dec 11, 5:29 pm, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> On 12/12/2010 7:14am, jc wrote:
>
> > Apache&  mod_wsgi are configured correctly (I've created a hello
> > world .html apache file and a hello world mod_wsgi application with
> > no
> > problems). I know need my Django app to recognize my django.wsgi
> > file.
> > What makes me think that it's not recognizing my wsgi file is that I
> > went into my django.wsgi file I created and completely deleted all of
> > the code in the file and restarted Apache and it still gives me the
> > same page (a listing of the files from Django app, not my actual
> > Django application. Configuring Apache and mod_wsgi went really well
> > but I'm at a loss of how to fix this. Here are some details instead of
> > "it's
> > not working":
>
> You are correct. Apache is not looking at the wsgi script. Have a look
> at the suggestions below ... before playing with django.wsgi.
>
>
>
>
>
>
>
>
>
>
>
> > Here is my current django.wsgi file:
>
> > import os
> > import sys
> > sys.path.append('/srv/www/duckling.org/store/')
> > os.environ = '/srv/www/duckling.org/
> > store/.python-
> > egg'
> > os.environ = 'settings'
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
>
> > I've tried a few different versions of the django.wsgi file
> > (including
> > a version like the one over athttp://www.djangoproject.com/).
> > This version of my wsgi is from here:
> >http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10...
>
> > Also, here is my vhost apache configuration file below. I think these
> > are
> > the main files that are suppose to do the job for me. Let me know if
> > you see any errors in what I'm doing and what else I might do to fix
> > this. The django app runs fine on the django's built-in development
> > server so I'm thinking it *might have* something with my paths.
> > No errors in my apache error.log file as well. It's acting as there's
> > no problem at all, which is not the case...the project isn't loading,
> > like I said just a listing of my files and directories of my Django
> > project. Here is my apache config file:
>
> > <VirtualHost 1.2.3.4:80>
> >      ServerAdmin h...@duckling.org
> >      ServerName duckling.org
> >      ServerAliaswww.duckling.org
>
> >      DocumentRoot /srv/www/duckling.org/store/
>
> # DocumentRoot is where you keep non-django stuff eg., static files
> # which is served by Apache without needing your Django code
> DocumentRoot /srv/www/duckling.org/htdocs/
>
>
>
> >      <Directory /srv/www/duckling.org/store/>
> >      Order Allow,Deny
> >      Allow from all
> >      </Directory>
>
> # now let the public access anything here
>   <Directory /srv/www/duckling.org/htdocs/>
>    AllowOverride None
>    Order deny,allow
>    Allow from all
>   </Directory>
>
>
>
> >      WSGIScriptAlias /django /srv/www/duckling.org/store/wsgi-scripts/
> > django.wsgi
> >      <Directory /srv/www/wsgi-scripts>
> >      Order allow,deny
> >      Allow from all
> >      </Directory>
> > </VirtualHost>
>
> Somewhere in your Apache config you have denied access to the entire
> filesystem to prevent outsiders from hacking in. Your Django code must
> also be hidden from outsiders so it will live safely in
> /srv/www/duckling.org/store because you haven't allowed anyone except
> Apache to see it.
>
> Now you need to provide an allowed conduit to your Django code. So make
> an Apache script alias to map the website root (ie '/') to your Django
> code. Because you are using mod_wsgi the entry point is your django.wsgi
> script. So map / to the script:
>   WSGIScriptAlias / /srv/www/duckling.org/store/wsgi-scripts/django.wsgi
>
> # and give the public full access - but only to the entry point
>   <Directory /srv/www/duckling.org/store/wsgi-scripts/>
>    Order deny,allow
>    Allow from all
>   </Directory>
>
> hth
> Mike
>
>
>
> > And here are versions of the stack that I'm using, I saw over at the
> > mod_wsgi site that you all would like the versions of what I'm using
> > on the server:
> > Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch
> > mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8
>
> I would remove mod_python if possible
>
>
>
>
>
>
>
>
>
> > thanks,
> > j.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Dec. 11, 2010 23:56:50

j.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


I've tried to fix my config files and it gives me a 500 error, here is
what i see n the logs. I've been told by someone else that they think
it's still my mod_wsgi/Apache configuration and not the error that I'm
getting in the log about missing modules. Any suggestions? Here is the
server error log message and my newly configured files:

#################################################
# error.log
#################################################
mod_wsgi (pid=20698): Exception occurred processing WSGI script '/
srv/
www/duckling.org/store/wsgi-scripts/django.wsgi'.
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
wsgi.py", line 230, in __call__
self.load_middleware()
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py", line 42, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s:
"%s"' % (mw_module, e))
ImproperlyConfigured: Error importing middleware
satchmo_store.shop.SSLMiddleware: "No module named
satchmo_store.shop.SSLMiddleware
I'm at a loss here as to how I find out if the problem lies with
mod_wsgi or apache configs or django or satchmo. So, I'm posting here
just in case someone might be able to help me out. Without some help
this project is as good as doomed as I don't have a lot of skills and
I'm learning along the way.

Here are my config files. I've went though many different versions,
this is my latest:
####################################
# apache vhost file called duckling.org
####################################
<VirtualHost 1.2.3.4:80>
ServerAdmin h...@duckling.org
ServerName duckling.org
ServerAlias www.duckling.org
DocumentRoot /srv/www/duckling.org/store/
<Directory /srv/www/duckling.org/store/>
Order Allow,Deny
Allow from all
</Directory>
Alias /static /srv/www/duckling.org/store/static/
<Directory /srv/www/duckling.org/store/static/>
AllowOverride None
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /srv/www/duckling.org/store/wsgi-scripts/
django.wsgi
<Directory /srv/www/duckling.org/store/wsgi-scripts/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
#########################
# django.wsgi file
#########################
import os
import sys
sys.path.append('/srv/www/duckling.org/store')
os.environ = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()


# With this current configuration I get a error in my server logs
for:
ImproperlyConfigured: Error importing middleware
satchmo_store.shop.SSLMiddleware: "No module named
satchmo_store.shop.SSLMiddleware"
Can anyone give me some clues as what I can do next? And if all else
fails, what are my alternatives as far as deploying this django app?
I've got time to "change plans" at this moment.

thanks again for the help!
j.

On Dec 11, 6:35 pm, jc <jimmy.case...@gmail.com> wrote:
> You definitely lost me in some places but you've also cleared some
> things up in the process. I also noticed that I had "<Directory /srv/
> www/wsgi-scripts>", which is lacking a directory for the
> WSGIScriptAlias. I've fixed that now. *Now*, I no longer get my
> listing of my files in my project when I go to my address *but* I now
> get 500 Internal Server Error. I'm not sure if I should trust the logs
> or maybe I've misconfigured something else (either in Apache or in my
> django.wsgi file)...I had this same issue yesterday 500 error...
>
> Also, when you said "Somewhere in your Apache config you have denied
> access to the entire filesystem", do  you mean *Apache* has done this
> so that it will keep others out of my project (not that I've actually
> done this somewhere, right?)
>
> After these changes, the project is still not running and I'm still
> not sure if it's my django app that's the issue or wsgi and my Apache
> configs. :/
>
> thanks for the reply back, I do appreciate it...
>
> j.
>
> On Dec 11, 5:29 pm, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
>
>
>
>
>
>
>
> > On 12/12/2010 7:14am, jc wrote:
>
> > > Apache&  mod_wsgi are configured correctly (I've created a hello
> > > world .html apache file and a hello world mod_wsgi application with
> > > no
> > > problems). I know need my Django app to recognize my django.wsgi
> > > file.
> > > What makes me think that it's not recognizing my wsgi file is that I
> > > went into my django.wsgi file I created and completely deleted all of
> > > the code in the file and restarted Apache and it still gives me the
> > > same page (a listing of the files from Django app, not my actual
> > > Django application. Configuring Apache and mod_wsgi went really well
> > > but I'm at a loss of how to fix this. Here are some details instead of
> > > "it's
> > > not working":
>
> > You are correct. Apache is not looking at the wsgi script. Have a look
> > at the suggestions below ... before playing with django.wsgi.
>
> > > Here is my current django.wsgi file:
>
> > > import os
> > > import sys
> > > sys.path.append('/srv/www/duckling.org/store/')
> > > os.environ = '/srv/www/duckling.org/
> > > store/.python-
> > > egg'
> > > os.environ = 'settings'
> > > import django.core.handlers.wsgi
> > > application = django.core.handlers.wsgi.WSGIHandler()
>
> > > I've tried a few different versions of the django.wsgi file
> > > (including
> > > a version like the one over athttp://www.djangoproject.com/).
> > > This version of my wsgi is from here:
> > >http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10...
>
> > > Also, here is my vhost apache configuration file below. I think these
> > > are
> > > the main files that are suppose to do the job for me. Let me know if
> > > you see any errors in what I'm doing and what else I might do to fix
> > > this. The django app runs fine on the django's built-in development
> > > server so I'm thinking it *might have* something with my paths.
> > > No errors in my apache error.log file as well. It's acting as there's
> > > no problem at all, which is not the case...the project isn't loading,
> > > like I said just a listing of my files and directories of my Django
> > > project. Here is my apache config file:
>
> > > <VirtualHost 1.2.3.4:80>
> > >      ServerAdmin h...@duckling.org
> > >      ServerName duckling.org
> > >      ServerAliaswww.duckling.org
>
> > >      DocumentRoot /srv/www/duckling.org/store/
>
> > # DocumentRoot is where you keep non-django stuff eg., static files
> > # which is served by Apache without needing your Django code
> > DocumentRoot /srv/www/duckling.org/htdocs/
>
> > >      <Directory /srv/www/duckling.org/store/>
> > >      Order Allow,Deny
> > >      Allow from all
> > >      </Directory>
>
> > # now let the public access anything here
> >   <Directory /srv/www/duckling.org/htdocs/>
> >    AllowOverride None
> >    Order deny,allow
> >    Allow from all
> >   </Directory>
>
> > >      WSGIScriptAlias /django /srv/www/duckling.org/store/wsgi-scripts/
> > > django.wsgi
> > >      <Directory /srv/www/wsgi-scripts>
> > >      Order allow,deny
> > >      Allow from all
> > >      </Directory>
> > > </VirtualHost>
>
> > Somewhere in your Apache config you have denied access to the entire
> > filesystem to prevent outsiders from hacking in. Your Django code must
> > also be hidden from outsiders so it will live safely in
> > /srv/www/duckling.org/store because you haven't allowed anyone except
> > Apache to see it.
>
> > Now you need to provide an allowed conduit to your Django code. So make
> > an Apache script alias to map the website root (ie '/') to your Django
> > code. Because you are using mod_wsgi the entry point is your django.wsgi
> > script. So map / to the script:
> >   WSGIScriptAlias / /srv/www/duckling.org/store/wsgi-scripts/django.wsgi
>
> > # and give the public full access - but only to the entry point
> >   <Directory /srv/www/duckling.org/store/wsgi-scripts/>
> >    Order deny,allow
> >    Allow from all
> >   </Directory>
>
> > hth
> > Mike
>
> > > And here are versions of the stack that I'm using, I saw over at the
> > > mod_wsgi site that you all would like the versions of what I'm using
> > > on the server:
> > > Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch
> > > mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8
>
> > I would remove mod_python if possible
>
> > > thanks,
> > > j.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Dec. 12, 2010 00:03:11

Tim S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


Here's the config I'm using for mod_wsgi:http://drumcoder.co.uk/blog/2009/nov/21/apache-mod_wsgi-config/Hope that helps,

Tim.

On 11/12/10 23:35, jc wrote:You definitely lost me in some places but you've also cleared some
things up in the process. I also noticed that I had "<Directory /srv/
www/wsgi-scripts>", which is lacking a directory for the
WSGIScriptAlias. I've fixed that now. *Now*, I no longer get my
listing of my files in my project when I go to my address *but* I now
get 500 Internal Server Error. I'm not sure if I should trust the logs
or maybe I've misconfigured something else (either in Apache or in my
django.wsgi file)...I had this same issue yesterday 500 error...

Also, when you said "Somewhere in your Apache config you have denied
access to the entire filesystem", do you mean *Apache* has done this
so that it will keep others out of my project (not that I've actually
done this somewhere, right?)

After these changes, the project is still not running and I'm still
not sure if it's my django app that's the issue or wsgi and my Apache
configs. :/

thanks for the reply back, I do appreciate it...

j.

On Dec 11, 5:29 pm, Mike Dewhirst<mi...@dewhirst.com.au> wrote:On 12/12/2010 7:14am, jc wrote:Apache& mod_wsgi are configured correctly (I've created a hello
world .html apache file and a hello world mod_wsgi application with
no
problems). I know need my Django app to recognize my django.wsgi
file.
What makes me think that it's not recognizing my wsgi file is that I
went into my django.wsgi file I created and completely deleted all of
the code in the file and restarted Apache and it still gives me the
same page (a listing of the files from Django app, not my actual
Django application. Configuring Apache and mod_wsgi went really well
but I'm at a loss of how to fix this. Here are some details instead of
"it's
not working":You are correct. Apache is not looking at the wsgi script. Have a look
at the suggestions below ... before playing with django.wsgi.Here is my current django.wsgi file:import os
import sys
sys.path.append('/srv/www/duckling.org/store/')
os.environ = '/srv/www/duckling.org/
store/.python-
egg'
os.environ = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()I've tried a few different versions of the django.wsgi file
(including
a version like the one over athttp://www.djangoproject.com/).
This version of my wsgi is from here:http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10...Also, here is my vhost apache configuration file below. I think these
are
the main files that are suppose to do the job for me. Let me know if
you see any errors in what I'm doing and what else I might do to fix
this. The django app runs fine on the django's built-in development
server so I'm thinking it *might have* something with my paths.
No errors in my apache error.log file as well. It's acting as there's
no problem at all, which is not the case...the project isn't loading,
like I said just a listing of my files and directories of my Django
project. Here is my apache config file:<VirtualHost 1.2.3.4:80>
ServerAdmin h...@duckling.org
ServerName duckling.org
ServerAliaswww.duckling.orgDocumentRoot /srv/www/duckling.org/store/# DocumentRoot is where you keep non-django stuff eg., static files
# which is served by Apache without needing your Django code
DocumentRoot /srv/www/duckling.org/htdocs/<Directory /srv/www/duckling.org/store/>
Order Allow,Deny
Allow from all
</Directory># now let the public access anything here
<Directory /srv/www/duckling.org/htdocs/>
AllowOverride None
Order deny,allow
Allow from all
</Directory>WSGIScriptAlias /django /srv/www/duckling.org/store/wsgi-scripts/
django.wsgi
<Directory /srv/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>Somewhere in your Apache config you have denied access to the entire
filesystem to prevent outsiders from hacking in. Your Django code must
also be hidden from outsiders so it will live safely in
/srv/www/duckling.org/store because you haven't allowed anyone except
Apache to see it.

Now you need to provide an allowed conduit to your Django code. So make
an Apache script alias to map the website root (ie '/') to your Django
code. Because you are using mod_wsgi the entry point is your django.wsgi
script. So map / to the script:
WSGIScriptAlias / /srv/www/duckling.org/store/wsgi-scripts/django.wsgi

# and give the public full access - but only to the entry point
<Directory /srv/www/duckling.org/store/wsgi-scripts/>
Order deny,allow
Allow from all
</Directory>

hth
MikeAnd here are versions of the stack that I'm using, I saw over at the
mod_wsgi site that you all would like the versions of what I'm using
on the server:
Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch
mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8I would remove mod_python if possiblethanks,
j.--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 Dec. 12, 2010 00:09:38

Mike D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


On 12/12/2010 10:35am, jc wrote:You definitely lost me in some places but you've also cleared some
things up in the process. I also noticed that I had "<Directory /srv/
www/wsgi-scripts>", which is lacking a directory for the
WSGIScriptAlias. I've fixed that now. *Now*, I no longer get my
listing of my files in my project when I go to my address *but* I now
get 500 Internal Server Error. I'm not sure if I should trust the logsAlways trust the logs. If you know enough about Apache to mistrust thelogs then you wouldn't be here.or maybe I've misconfigured something else (either in Apache or in my
django.wsgi file)...I had this same issue yesterday 500 error...

Also, when you said "Somewhere in your Apache config you have denied
access to the entire filesystem", do you mean *Apache* has done this
so that it will keep others out of my project (not that I've actually
done this somewhere, right?)Somewhere in your Apache config there will be something like this ...

# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>... which - as the comment says - locks the public out of everything onthe server. <Directory /> actually means the root of the server itself.In other words /. The '/>' is not an XML closing tag even though itmight look like it.This is why you need to specifically open up public access to htdocs andyour wsgi script directory. Incidentally, it is also why your Djangocode should not be in your your wsgi script directory. If it was Apachecould reveal it to the public - which is what I think you weredescribing earlier.After these changes, the project is still not running and I'm still
not sure if it's my django app that's the issue or wsgi and my Apache
configs. :/1. In WSGIScriptAlias you map your wsgi script (django.wsgi itself) tothe root of your duckling website. In other words your wsgi scriptbecomes the / which is the slash at the end ofhttp://1.2.3.4/2. Your Apache config opens up access to the directory in which thatscript lives - in other words you create a hole in the entire filesystemlockdown.To gain more info on wsgi scripts try ...http://code.google.com/p/modwsgi/wiki/DebuggingTechniquesGood luck

Mikethanks for the reply back, I do appreciate it...

j.

On Dec 11, 5:29 pm, Mike Dewhirst<mi...@dewhirst.com.au> wrote:On 12/12/2010 7:14am, jc wrote:Apache& mod_wsgi are configured correctly (I've created a hello
world .html apache file and a hello world mod_wsgi application with
no
problems). I know need my Django app to recognize my django.wsgi
file.
What makes me think that it's not recognizing my wsgi file is that I
went into my django.wsgi file I created and completely deleted all of
the code in the file and restarted Apache and it still gives me the
same page (a listing of the files from Django app, not my actual
Django application. Configuring Apache and mod_wsgi went really well
but I'm at a loss of how to fix this. Here are some details instead of
"it's
not working":You are correct. Apache is not looking at the wsgi script. Have a look
at the suggestions below ... before playing with django.wsgi.Here is my current django.wsgi file:import os
import sys
sys.path.append('/srv/www/duckling.org/store/')
os.environ = '/srv/www/duckling.org/
store/.python-
egg'
os.environ = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()I've tried a few different versions of the django.wsgi file
(including
a version like the one over athttp://www.djangoproject.com/).
This version of my wsgi is from here:http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10...Also, here is my vhost apache configuration file below. I think these
are
the main files that are suppose to do the job for me. Let me know if
you see any errors in what I'm doing and what else I might do to fix
this. The django app runs fine on the django's built-in development
server so I'm thinking it *might have* something with my paths.
No errors in my apache error.log file as well. It's acting as there's
no problem at all, which is not the case...the project isn't loading,
like I said just a listing of my files and directories of my Django
project. Here is my apache config file:<VirtualHost 1.2.3.4:80>
ServerAdmin h...@duckling.org
ServerName duckling.org
ServerAliaswww.duckling.orgDocumentRoot /srv/www/duckling.org/store/# DocumentRoot is where you keep non-django stuff eg., static files
# which is served by Apache without needing your Django code
DocumentRoot /srv/www/duckling.org/htdocs/<Directory /srv/www/duckling.org/store/>
Order Allow,Deny
Allow from all
</Directory># now let the public access anything here
<Directory /srv/www/duckling.org/htdocs/>
AllowOverride None
Order deny,allow
Allow from all
</Directory>WSGIScriptAlias /django /srv/www/duckling.org/store/wsgi-scripts/
django.wsgi
<Directory /srv/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>Somewhere in your Apache config you have denied access to the entire
filesystem to prevent outsiders from hacking in. Your Django code must
also be hidden from outsiders so it will live safely in
/srv/www/duckling.org/store because you haven't allowed anyone except
Apache to see it.

Now you need to provide an allowed conduit to your Django code. So make
an Apache script alias to map the website root (ie '/') to your Django
code. Because you are using mod_wsgi the entry point is your django.wsgi
script. So map / to the script:
WSGIScriptAlias / /srv/www/duckling.org/store/wsgi-scripts/django.wsgi

# and give the public full access - but only to the entry point
<Directory /srv/www/duckling.org/store/wsgi-scripts/>
Order deny,allow
Allow from all
</Directory>

hth
MikeAnd here are versions of the stack that I'm using, I saw over at the
mod_wsgi site that you all would like the versions of what I'm using
on the server:
Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch
mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8I would remove mod_python if possiblethanks,
j.--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#7 Dec. 12, 2010 01:06:58

Mike D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


On 12/12/2010 10:56am, jc wrote:I've tried to fix my config files and it gives me a 500 error, here is
what i see n the logs. I've been told by someone else that they think
it's still my mod_wsgi/Apache configuration and not the error that I'm
getting in the log about missing modules. Any suggestions? Here is the
server error log message and my newly configured files:

#################################################
# error.log
#################################################
mod_wsgi (pid=20698): Exception occurred processing WSGI script '/
srv/
www/duckling.org/store/wsgi-scripts/django.wsgi'.
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
wsgi.py", line 230, in __call__
self.load_middleware()
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py", line 42, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s:
"%s"' % (mw_module, e))
ImproperlyConfigured: Error importing middleware
satchmo_store.shop.SSLMiddleware: "No module named
satchmo_store.shop.SSLMiddleware
I'm at a loss here as to how I find out if the problem lies with
mod_wsgi or apache configs or django or satchmo. So, I'm posting here
just in case someone might be able to help me out. Without some help
this project is as good as doomed as I don't have a lot of skills and
I'm learning along the way.The loading middleware error seems straightforward. My guess is themodule containing the middleware cannot be found.If you installed Satchmo correctly it will have added itself properly tothe Python path and that error wouldn't occur.If you are learning and still need to develop your skills I wouldrecommend using the Django dev server to try it out.hth

Mike

<snip>

--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#8 Dec. 12, 2010 01:13:34

j.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


I think after that comment I'm slowly getting it but I still need to
go back and learn more. Regardless of the the horrible security holes
in my application, this still wouldn't do anything as far as *not*
making this django app run, would it? In other words, I know it's
insecure as hell to do what I'm doing but that is *not* the reason my
django app is not running, correct?

thanks again,
j.

On Dec 11, 7:09 pm, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> On 12/12/2010 10:35am, jc wrote:
>
> > You definitely lost me in some places but you've also cleared some
> > things up in the process. I also noticed that I had "<Directory /srv/
> > www/wsgi-scripts>", which is lacking a directory for the
> > WSGIScriptAlias. I've fixed that now. *Now*, I no longer get my
> > listing of my files in my project when I go to my address *but* I now
> > get 500 Internal Server Error. I'm not sure if I should trust the logs
>
> Always trust the logs. If you know enough about Apache to mistrust the
> logs then you wouldn't be here.
>
> > or maybe I've misconfigured something else (either in Apache or in my
> > django.wsgi file)...I had this same issue yesterday 500 error...
>
> > Also, when you said "Somewhere in your Apache config you have denied
> > access to the entire filesystem", do  you mean *Apache* has done this
> > so that it will keep others out of my project (not that I've actually
> > done this somewhere, right?)
>
> Somewhere in your Apache config there will be something like this ...
>
> # forbid access to the entire filesystem by default
> <Directory />
>      Options None
>      AllowOverride None
>      Order deny,allow
>      Deny from all
> </Directory>
>
> ... which - as the comment says - locks the public out of everything on
> the server. <Directory /> actually means the root of the server itself.
> In other words /. The '/>' is not an XML closing tag even though it
> might look like it.
>
> This is why you need to specifically open up public access to htdocs and
> your wsgi script directory. Incidentally, it is also why your Django
> code should not be in your your wsgi script directory. If it was Apache
> could reveal it to the public - which is what I think you were
> describing earlier.
>
>
>
> > After these changes, the project is still not running and I'm still
> > not sure if it's my django app that's the issue or wsgi and my Apache
> > configs. :/
>
> 1. In WSGIScriptAlias you map your wsgi script (django.wsgi itself) to
> the root of your duckling website. In other words your wsgi script
> becomes the / which is the slash at the end ofhttp://1.2.3.4/>
> 2. Your Apache config opens up access to the directory in which that
> script lives - in other words you create a hole in the entire filesystem
> lockdown.
>
> To gain more info on wsgi scripts try ...
>
>http://code.google.com/p/modwsgi/wiki/DebuggingTechniques>
> Good luck
>
> Mike
>
>
>
>
>
>
>
>
>
> > thanks for the reply back, I do appreciate it...
>
> > j.
>
> > On Dec 11, 5:29 pm, Mike Dewhirst<mi...@dewhirst.com.au>  wrote:
> >> On 12/12/2010 7:14am, jc wrote:
>
> >>> Apache&    mod_wsgi are configured correctly (I've created a hello
> >>> world .html apache file and a hello world mod_wsgi application with
> >>> no
> >>> problems). I know need my Django app to recognize my django.wsgi
> >>> file.
> >>> What makes me think that it's not recognizing my wsgi file is that I
> >>> went into my django.wsgi file I created and completely deleted all of
> >>> the code in the file and restarted Apache and it still gives me the
> >>> same page (a listing of the files from Django app, not my actual
> >>> Django application. Configuring Apache and mod_wsgi went really well
> >>> but I'm at a loss of how to fix this. Here are some details instead of
> >>> "it's
> >>> not working":
>
> >> You are correct. Apache is not looking at the wsgi script. Have a look
> >> at the suggestions below ... before playing with django.wsgi.
>
> >>> Here is my current django.wsgi file:
>
> >>> import os
> >>> import sys
> >>> sys.path.append('/srv/www/duckling.org/store/')
> >>> os.environ = '/srv/www/duckling.org/
> >>> store/.python-
> >>> egg'
> >>> os.environ = 'settings'
> >>> import django.core.handlers.wsgi
> >>> application = django.core.handlers.wsgi.WSGIHandler()
>
> >>> I've tried a few different versions of the django.wsgi file
> >>> (including
> >>> a version like the one over athttp://www.djangoproject.com/).
> >>> This version of my wsgi is from here:
> >>>http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10...
>
> >>> Also, here is my vhost apache configuration file below. I think these
> >>> are
> >>> the main files that are suppose to do the job for me. Let me know if
> >>> you see any errors in what I'm doing and what else I might do to fix
> >>> this. The django app runs fine on the django's built-in development
> >>> server so I'm thinking it *might have* something with my paths.
> >>> No errors in my apache error.log file as well. It's acting as there's
> >>> no problem at all, which is not the case...the project isn't loading,
> >>> like I said just a listing of my files and directories of my Django
> >>> project. Here is my apache config file:
>
> >>> <VirtualHost 1.2.3.4:80>
> >>>       ServerAdmin h...@duckling.org
> >>>       ServerName duckling.org
> >>>       ServerAliaswww.duckling.org
>
> >>>       DocumentRoot /srv/www/duckling.org/store/
>
> >> # DocumentRoot is where you keep non-django stuff eg., static files
> >> # which is served by Apache without needing your Django code
> >> DocumentRoot /srv/www/duckling.org/htdocs/
>
> >>>       <Directory /srv/www/duckling.org/store/>
> >>>       Order Allow,Deny
> >>>       Allow from all
> >>>       </Directory>
>
> >> # now let the public access anything here
> >>    <Directory /srv/www/duckling.org/htdocs/>
> >>     AllowOverride None
> >>     Order deny,allow
> >>     Allow from all
> >>    </Directory>
>
> >>>       WSGIScriptAlias /django /srv/www/duckling.org/store/wsgi-scripts/
> >>> django.wsgi
> >>>       <Directory /srv/www/wsgi-scripts>
> >>>       Order allow,deny
> >>>       Allow from all
> >>>       </Directory>
> >>> </VirtualHost>
>
> >> Somewhere in your Apache config you have denied access to the entire
> >> filesystem to prevent outsiders from hacking in. Your Django code must
> >> also be hidden from outsiders so it will live safely in
> >> /srv/www/duckling.org/store because you haven't allowed anyone except
> >> Apache to see it.
>
> >> Now you need to provide an allowed conduit to your Django code. So make
> >> an Apache script alias to map the website root (ie '/') to your Django
> >> code. Because you are using mod_wsgi the entry point is your django.wsgi
> >> script. So map / to the script:
> >>    WSGIScriptAlias / /srv/www/duckling.org/store/wsgi-scripts/django.wsgi
>
> >> # and give the public full access - but only to the entry point
> >>    <Directory /srv/www/duckling.org/store/wsgi-scripts/>
> >>     Order deny,allow
> >>     Allow from all
> >>    </Directory>
>
> >> hth
> >> Mike
>
> >>> And here are versions of the stack that I'm using, I saw over at the
> >>> mod_wsgi site that you all would like the versions of what I'm using
> >>> on the server:
> >>> Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch
> >>> mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8
>
> >> I would remove mod_python if possible
>
> >>> thanks,
> >>> j.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#9 Dec. 12, 2010 01:35:22

j.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


I ran the Django develplment server and everything runs fine. It's
only when I go back to the other web server that things start to break
on me.

On Dec 11, 8:06 pm, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> On 12/12/2010 10:56am, jc wrote:
>
>
>
>
>
>
>
>
>
> > I've tried to fix my config files and it gives me a 500 error, here is
> > what i see n the logs. I've been told by someone else that they think
> > it's still my mod_wsgi/Apache configuration and not the error that I'm
> > getting in the log about missing modules. Any suggestions? Here is the
> > server error log message and my newly configured files:
>
> > #################################################
> > # error.log
> > #################################################
> > mod_wsgi (pid=20698): Exception occurred processing WSGI script '/
> > srv/
> > www/duckling.org/store/wsgi-scripts/django.wsgi'.
> > Traceback (most recent call last):
> > File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> > wsgi.py", line 230, in __call__
> >       self.load_middleware()
> > File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> > base.py", line 42, in load_middleware
> > raise exceptions.ImproperlyConfigured('Error importing middleware %s:
> > "%s"' % (mw_module, e))
> >   ImproperlyConfigured: Error importing middleware
> > satchmo_store.shop.SSLMiddleware: "No module named
> > satchmo_store.shop.SSLMiddleware
> > I'm at a loss here as to how I find out if the problem lies with
> > mod_wsgi or apache configs or django or satchmo. So, I'm posting here
> > just in case someone might be able to help me out. Without some help
> > this project is as good as doomed as I don't have a lot of skills and
> > I'm learning along the way.
>
> The loading middleware error seems straightforward. My guess is the
> module containing the middleware cannot be found.
>
> If you installed Satchmo correctly it will have added itself properly to
> the Python path and that error wouldn't occur.
>
> If you are learning and still need to develop your skills I would
> recommend using the Django dev server to try it out.
>
> hth
>
> Mike
>
> <snip>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#10 Dec. 12, 2010 11:55:23

Mike D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file.


On 12/12/2010 12:35pm, jc wrote:I ran the Django develplment server and everything runs fine. It's
only when I go back to the other web server that things start to break
on me.In that case check outhttp://blip.tv/file/3840484for GrahamDumpleton's talk on precisely the problem you describe.hth

MikeOn Dec 11, 8:06 pm, Mike Dewhirst<mi...@dewhirst.com.au> wrote:On 12/12/2010 10:56am, jc wrote:I've tried to fix my config files and it gives me a 500 error, here is
what i see n the logs. I've been told by someone else that they think
it's still my mod_wsgi/Apache configuration and not the error that I'm
getting in the log about missing modules. Any suggestions? Here is the
server error log message and my newly configured files:#################################################
# error.log
#################################################
mod_wsgi (pid=20698): Exception occurred processing WSGI script '/
srv/
www/duckling.org/store/wsgi-scripts/django.wsgi'.
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
wsgi.py", line 230, in __call__
self.load_middleware()
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py", line 42, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s:
"%s"' % (mw_module, e))
ImproperlyConfigured: Error importing middleware
satchmo_store.shop.SSLMiddleware: "No module named
satchmo_store.shop.SSLMiddleware
I'm at a loss here as to how I find out if the problem lies with
mod_wsgi or apache configs or django or satchmo. So, I'm posting here
just in case someone might be able to help me out. Without some help
this project is as good as doomed as I don't have a lot of skills and
I'm learning along the way.The loading middleware error seems straightforward. My guess is the
module containing the middleware cannot be found.

If you installed Satchmo correctly it will have added itself properly to
the Python path and that error wouldn't occur.

If you are learning and still need to develop your skills I would
recommend using the Django dev server to try it out.

hth

Mike

<snip>--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Apache & mod_wsgi are configured correctly. Need Django to recognize my django.wsgi file. [RSS Feed]

Board footer

Moderator control

Enjoy the 17th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support