Saturday, June 19, 2010

Re: Deploying Django with mod_wsgi

On Jun 20, 1:08 pm, lzantal <lzan...@gmail.com> wrote:
> Hi,
>
> If you add your project due to the sys.path then don't add the project  
> name to  os.environ['DJANGO_SETTINGS_MODULE'] = 'ash.settings'
> just add settings.

Which can cause other problems if you have used site name as package
prefix in module imports or urls.py.

The only safe way that covers everything is to actually add both
parent directory and site directory to sys.path. Even that though
doesn't set up process environment for WSGIHandler same as Django
development server does for application

As referenced before, read:

http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html

This explains lots of issues related to this.

Graham

> hope it helps
>
> lzantal
>
> On Jun 19, 2010, at 19:48, commonzenpython <commonzenpyt...@gmail.com>  
> wrote:
>
>
>
> > thanks, i have seen the error logs and it says "could not import
> > settings "ash.settings" ( is it on sys path ?)"  ash is the name of my
> > project, also i didnt get a 500 error this time, my website just didnt
> > load, i added the following configuration to the httpd.conf :
> > LoadModule wsgi_module modules/mod_wsgi.so
>
> > and then i put:
>
> > WSGIScriptAlias / /ash/apache/ django.wsgi  #which isn't the actual
> > things i typed for security purposes but its basically the same since
> > its a path to my wsgi file
>
> > this is whats inside my wsgi file:
>
> > import os
> > import sys
> > sys.path.append('PATH/ash') # again i changed the actual adress for
> > security purposes but the path leads to my project called ash
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'ash.settings'
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
>
> > --
> > You received this message because you are subscribed to the Google  
> > Groups "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com
> > .
> > For more options, visit this group athttp://groups.google.com/group/django-users?hl=en
> > .

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate