On Dec 2, 4:53 pm, neridaj <[email protected]> wrote:
> I have a few novice user questions:
>
> 1. If I installed apache2 with prefork do I need to uninstall in order
> to change to worker?

Uninstall what? Apache or mod_wsgi?

Also, what you need to do really depends on how you installed both,
whether from source code yourself or from binary packages. Too hard to
say as have no idea. If binary packages, follow your Linux
distributions documentation or use their tools appropriately.

> 2. If I add the following lines to my vhost definition does this make
> mod_wsgi run in daemon mode?
>
>   WSGIDaemonProcess mysite.com processes=1 threads=5 display-name=%
> {GROUP}
>   WSGIProcessGroup mysite.com

Don't use 'processes=1' as it defaults to one process if that option
isn't set and setting has certain implications. That is explained in
description of that option in documentation I directed you to last
time.

Read that documentation again as well as:

  http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide

> 3. What is the syntax for adding the value of PYTHONPATH to the python-
> path= option?

The documentation I referred you to last time describes what it should
be in the section related to that option. Specifically, colon
separated list of directories, exactly like PYTHONPATH user
environment variable. I even said to use exact same value as used for
PYTHONPATH in past post.

> 4. What is the syntax for adding the python-path option to
> apache2.conf?

How is this question different to (3).

Also perhaps read:

  http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

if you want to know more about setting Python module search path.

If you are a novice as you say, then try and endeavour to read
documentation you are referred to and also look at what other
documentation exists on that site, starting at:

  http://code.google.com/p/modwsgi/wiki/InstallationInstructions

Graham

>
> J
> On Dec 1, 5:22 pm, Graham Dumpleton <[email protected]>
> wrote:
>
>
>
> > On Dec 2, 12:02 pm, neridaj <[email protected]> wrote:
>
> > > During development I had my project apps in the same directory that
> > > django-admin.py startproject mysite created. I would now like to have
> > > my apps in a global directory, django-apps, to be used in other
> > > projects. I thought this was what the PYTHONPATH environment variable
> > > was for, do I need to add every PYTHONPATH module directory
> > > from .profile to mysite.wsgi?
>
> > Any directories listed in PYTHONPATH environment variable of user when
> > running django-admin.py, must be individually added to 'sys.path' in
> > the WSGI script file.
>
> > Alternatively, take what you have in PYTHONPATH and use that same
> > value to define WSGIPythonPath directive if using mod_wsgi embedded
> > mode, or the python-path option to WSGIDaemonProcess if using mod_wsgi
> > daemon mode. For information about the latter two directives see:
>
> >  http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPyt...
> >  http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDae...
>
> > Do note that by doing it in WSGI script file, only applies to that
> > Django instance. If done in Apache configuration, applies to all
> > Django instances running in embedded mode or that daemon mode process
> > group, as appropriate for way configured.
>
> > As such, setting these in WSGI script file is better if they relate
> > only to a specific Django instance.
>
> > Graham
>
> > > On Dec 1, 3:03 pm, Graham Dumpleton <[email protected]>
> > > wrote:
>
> > > > Have a read of:
>
> > > >http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> > > > In particular where it says:
>
> > > > """
> > > > If you have been using the Django development server and have made use
> > > > of the fact that it is possible when doing explicit imports, or when
> > > > referencing modules in 'urls.py', to leave out the name of the site
> > > > and use a relative module path, you will also need to add to sys.path
> > > > the path to the site package directory itself.
>
> > > > sys.path.append('/usr/local/django')
> > > > sys.path.append('/usr/local/django/mysite')
>
> > > > In other words, you would have the path to the directory containing
> > > > the 'settings.py' file created by 'django-admin.py startproject', as
> > > > well as the parent directory of that directory, as originally added
> > > > above.
>
> > > > Note that it is not recommended to be setting 'DJANGO_SETTINGS_MODULE'
> > > > to be 'settings' and only listing the path to the directory containing
> > > > the 'settings.py' file. This is because such a setup will not mirror
> > > > properly how the Django development server works and everything may
> > > > not work as expected.
> > > > """
>
> > > > You have only added the path to the parent directory and not the path
> > > > of the directory containing the settings.py file. Your use of relative
> > > > modules references within the site package may therefore be a problem.
>
> > > > Graham
>
> > > > On Dec 2, 9:43 am, neridaj <[email protected]> wrote:
>
> > > > > I'm using the same setup I have for another django site running on the
> > > > > same server. I haven't had to use the python-path arg to WDP before so
> > > > > I'm not sure how to do that. I'm still pretty new to this so any help
> > > > > would be much appreciated. I'm using the same wsgi script that works
> > > > > for the other site so I don't see any problem but here it is if you
> > > > > want to have a look:
>
> > > > > import os, sys
>
> > > > > path = '/home/username/public_html/mysite.com/'
> > > > > if path not in sys.path:
> > > > >     sys.path.append(path)
>
> > > > > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
>
> > > > > import django.core.handlers.wsgi
>
> > > > > _application = django.core.handlers.wsgi.WSGIHandler()
>
> > > > > def application(environ, start_response):
> > > > >     environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME',
> > > > > 'http')
> > > > >     return _application(environ, start_response)
>
> > > > > On Dec 1, 1:53 pm, Skylar Saveland <[email protected]> wrote:
>
> > > > > > Are you using python-path arg to WDP?  Also, you might do some
> > > > > > sys.path hacking in the .wsgi script.
>
> > > > > > neridaj wrote:
> > > > > > > Hello,
>
> > > > > > > I'm trying to deploy my project to my server and I don't 
> > > > > > > understand
> > > > > > > why django isn't finding modules I've added to my pythonpath. 
> > > > > > > When I
> > > > > > > try to access my site I get 500 errors and after looking at the 
> > > > > > > server
> > > > > > > log I see a traceback with this:
>
> > > > > > > [error] [client 174.xxx.xxx.xxx] ImportError: No module named blog
>
> > > > > > > However, when I run python I am able to import the modules. I'm 
> > > > > > > using
> > > > > > > nginx as a proxy to apache2/mod_wsgi on Ubuntu 9.04.
>
> > > > > > > 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to