On Wednesday, 2 July 2014 02:08:24 UTC+2, Graham Dumpleton wrote:
>
>
> On 01/07/2014, at 10:53 PM, Liam Thompson <[email protected] <javascript:>> 
> 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. 
>

Yes, the mod_wsgi installed using pip, which is now 4.2.5 after your update.
 

>
> > 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' 
>

My directory structure is a little different

instead of mysite/mysite, it is just mysite/

mysite 
mysite/static
mysite/media

mysite/manage.py 
mysite/urls.py 

mysite/settings/__init__.py 
mysite/settings/local.py
mysite/settings/base.py

mysite/apache/apache.wsgi

mysite/myapp
mysite/myapp/__init__.py 
mysite/myapp/views.py 

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

So when I start the mod_wsgi-express server I use "mod_wsgi-express 
start-server apache/apache.wsgi"
 

>
> 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. 
>

I've only used one version of Django for this project (1.5.3).
 

>
> > ---------- 
> > 
> > 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/' 
>

My 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') 
>

My STATIC_ROOT is set to STATIC_ROOT =  os.path.join(DJANGO_ROOT, 'static') 
with DJANGO_ROOT being "mysite" mentioned above (equating to 
"mysite/static").

I tried changing the above to 'htdocs' instead, re-running collectstatic 
(all files are copied), but it still doesn't propagate across when I 
deactivate/reactive the server and virtualenv.

If I use your example 

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

it sends me to 
"mysite/env/lib/python2.6/site-packages/django/core/management/htdocs"


> Did you then run: 
>
> python manage.py collectstatic 
>

I did yes, all files were then copied into either 'mysite/htdocs' or 
'mysite/static' depending on what I had specified.
 

>
> before running: 
>
> python manage.py runmodwsgi 
>

It is still giving me "No module named wsgi", and the styling is still not 
visible without symbolic linking.

'mod_wsgi.server' is listed under INSTALLED_APPS
 

>
> 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. :-) 
>

I think this is a reasonable assumption. :-)
 
Liam



> 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