On Sun, 12 May 2013 03:17:04 -0700 (PDT) Stanley Agba <stanley.a...@gmail.com> wrote:
> Hello guys, > please I'm kind of a noob at django and I'm trying to deploy a django > site on Apache with mod_wsgi, I am not using a virtualenv as the > server has python installed. > I added the following to my /etc/apache2/apache2.conf > > <VirtualHost example:80> > ServerName example > ServerAlias example > ServerAdmin exam...@example.com > > DocumentRoot /var/www/example/static > WSGIScriptAlias / /var/www/example/example/wsgi.py > WSGIPythonPath /var/www/example > <Directory /var/www/example/example> > <Files wsgi.py> > Order allow,deny > Allow from all > </Files> > </Directory> > > Alias /head.jpg /var/www/example/static/head.jpg > Alias /media/ /var/www/example/uploads > Alias /static /var/www/example/static > > <Directory /var/www/example/static> > Order deny,allow > Allow from all > </Directory> > > <Directory /var/www/example/uploads> > Order deny,allow > Allow from all > </Directory> > > ErrorLog /var/www/python_ng/logs/error.log > CustomLog /var/www/python_ng/logs/access.log combined > </VirtualHost> > > I got a 'WSGIPythonPath cannot be in virtual host section' error. > I have searched for previous topics but i have not been able to get a > solution, I would greatly appreciate any help. > Thanks The WSGIPyhtonPath must be moved outside of the <VirtualHost> configuration directive. I.e. it must be in the "root" of Apache configuration. For example, this would work: ----%---- WSGIPythonPath /var/www/example <VirtualHost example:80> ServerName example ServerAlias example ServerAdmin exam...@example.com DocumentRoot /var/www/example/static WSGIScriptAlias / /var/www/example/example/wsgi.py <Directory /var/www/example/example> <Files wsgi.py> Order allow,deny Allow from all </Files> </Directory> Alias /head.jpg /var/www/example/static/head.jpg Alias /media/ /var/www/example/uploads Alias /static /var/www/example/static <Directory /var/www/example/static> Order deny,allow Allow from all </Directory> <Directory /var/www/example/uploads> Order deny,allow Allow from all </Directory> ErrorLog /var/www/python_ng/logs/error.log CustomLog /var/www/python_ng/logs/access.log combined </VirtualHost> ----%---- Keep in mind that setting the path in this way means it gets set like that for _all_ mod_wsgi apps you might have. Most people therefore use a bit different solution where they set-up the Python path within the wsgi.py instead (if you want to host multiple independent Django projects). Best regards -- Branko Majic Jabber: bra...@majic.rs Please use only Free formats when sending attachments to me. Бранко Мајић Џабер: bra...@majic.rs Молим вас да додатке шаљете искључиво у слободним форматима.
signature.asc
Description: PGP signature