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? 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 3. What is the syntax for adding the value of PYTHONPATH to the python- path= option? 4. What is the syntax for adding the python-path option to apache2.conf? Thanks for all your help so far, J On Dec 1, 5:22 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Dec 2, 12:02 pm, neridaj <neri...@gmail.com> 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 <graham.dumple...@gmail.com> > > 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 <neri...@gmail.com> 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 <skylar.savel...@gmail.com> 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 django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.