On 01/07/2014, at 10:53 PM, Liam Thompson <[email protected]> wrote:

> 
> Hi Graham, everyone
> 
> Running Ubuntu 13.10, Apache 2.4.6, base wsgi 3.4, pypi wsgi 4.4.2

I presume you mean mod_wsgi 4.2.4 installed using pip. The vase mod_wsgi 
version shouldn't matter.

> Following the instructions from the PyPi mod_wsgi pages I'm trying to get the 
> pypi modules to work with django
> (virtualenv activated).
> 
> Everything is fine up until I run "python -v manage.py runmodwsgi"
> 
> whereafter I receive a 
> 
> # /opt/code_home/.../apache/__init__.pyc matches 
> /opt/code_home/.../apache/__init__.py
> import apache # precompiled from /opt/code_home/.../apache/__init__.pyc
> ImportError: No module named wsgi
> 
> Obviously an import error, perhaps another one of those pesky path problems 
> from Django ? I don't get this error running 
> the site from the base wsgi, so there must be information missing that 
> pypi-wsgi needs.

What is WSGI_APPLICATION set to in the Django settings.py file, and what is the 
directory structure you have?

Normally the structure would be:

mysite
mysite/htdocs/*
mysite/manage.py
mysite/mysite
mysite/mysite/__init__.py
mysite/mysite/settings.py
mysite/mysite/urls.py
mysite/mysite/views.py
mysite/mysite/wsgi.py

Key settings in the settings.py file would then be:

ROOT_URLCONF = 'mysite.urls'
WSGI_APPLICATION = 'mysite.wsgi.application'

If you have moved anything around or have a project which has been updated from 
an older version of Django, then things may not match up.

> ----------
> 
> As a second question
> 
> When I run "mod_wsgi-express start-server" and navigating to the site, none 
> of the static files are found. It seems the settings
> related to the static files (and perhaps others ) from the Django project 
> settings and not making their way through to the document
> root of the mod_wsgi-express server settings.
> 
> If I symbolically link the static directory into the /tmp.../htdocs directory 
> then everything loads as it should.
> 
> Just wondering if this was intentional ? Might be good to mention it in the 
> docs if yes.

What have you got STATIC_URL set to:

STATIC_URL = '/static/'

Did you set STATIC_ROOT to a directory to contain your static file assists, in 
this example:

STATIC_ROOT = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'htdocs')

Did you then run:

python manage.py collectstatic

before running:

python manage.py runmodwsgi

The instructions currently assume that you know that you have to set 
STATIC_ROOT to a directory to put static assets in when using collectstatic, 
which is probably not a good idea on my part. :-)

Graham


-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to