The second program that outputs sys.path, not the first.

import sys

def application(environ, start_response):
    status = '200 OK'
    output = 'sys.path = %s' % repr(sys.path)

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]


Graham

> On 22 Oct 2015, at 10:12 pm, Justin Martin <[email protected]> wrote:
> 
> Graham,
> I got what's pasted below
> 
> sys.version = '2.6.6 (r266:84292, Nov 21 2013, 10:50:32) \n[GCC 4.4.7 
> 21020313 (Red Hat 4.4.7-4)]'
> sys.prefix = '/usr'
> 
> 
> On Oct 22, 2015 07:03, "Graham Dumpleton" <[email protected] 
> <mailto:[email protected]>> wrote:
> What do you get if you use the test WSGI application in:
> 
> https://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Installation_In_Use
>  
> <https://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Installation_In_Use>
> 
> to print out what sys.path is inside of the WSGI application process?
> 
> Graham
> 
>> On 22 Oct 2015, at 12:47 pm, Justin Martin <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> I got /usr/lib/python2.6/site-packages/django/__init__.pyc
>> 
>> I am pretty sure I'm not using a virtual environment but I'd there a way to 
>> tell if django is installed in system wide python? I am not sure if django 
>> was installed via rpm or from the repo or how it was installed as it was 
>> already installed
>> 
>> On Oct 20, 2015 17:09, "Graham Dumpleton" <[email protected] 
>> <mailto:[email protected]>> wrote:
>> Correct, you would use something like:
>> 
>>     Order allow,deny
>>     Allow from all
>> 
>> within the Directory block set up to allow access to the directory 
>> containing the WSGI script file.
>> 
>> As this is Red Hat, maybe the issue is a SELinux issue restrictions on 
>> Apache, although since you aren’t using a Python virtual environment, if 
>> Django is installed in system wide Python it should be accessible.
>> 
>> At the Python interpreter, what do you get for:
>> 
>>     import django
>>     print django.__file__
>> 
>> Graham
>> 
>>> On 21 Oct 2015, at 3:09 am, Justin Martin <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> No worries I was just making sure the post didn't get lost. I did the 
>>> django.get_version() and it returned 1.6.1. I'm using apache 2.2 and I 
>>> shouldn't have to use Require all granted and I get a authtype not set. I 
>>> should be using the order and granted correct?
>>> 
>>> Thanks,
>>> Justin
>>> 
>>> On Oct 19, 2015 23:30, "Graham Dumpleton" <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> Sorry for the slow reply, been travelling for work the last couple of weeks.
>>> 
>>> From the Python interpreter, what do you get if you go:
>>> 
>>> $ python
>>> Python 2.7.10 (default, Jul 14 2015, 19:46:27)
>>> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> >>> import django
>>> >>> django.get_version()
>>> ‘1.7.1'
>>> 
>>> This will validate Django is actually installed, but also tell you how old 
>>> of a Django version you have.
>>> 
>>> The wsgi.py code you have likely need Django 1.4 (???) or newer.
>>> 
>>> Am wondering whether you have a really old version of Django installed from 
>>> a system package, rather than you having pip installed it yourself.
>>> 
>>> Graham
>>> 
>>>> On 15 Oct 2015, at 6:10 am, Justin Martin <[email protected] 
>>>> <mailto:[email protected]>> wrote:
>>>> 
>>>> Graham,
>>>> 
>>>> I'm not using python in a virtual environment no. 
>>>> 
>>>> I ran the checks and this is what was returned. 
>>>> 
>>>> linux_vdso.so.1 => (0x00007fff4c6ae000)
>>>> libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007fb7830e0000)
>>>> libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb782ec30000)
>>>> libdl.so.2 => /lib64/libdl.so.2 (0x00007fb782cbe000)
>>>> libutil.so.1 => /lib64/libutil.so.1 (0x00007fb782abb000)
>>>> libm.so.6 => /lib64/libm.so.6 (0x00007fb782837000)
>>>> libc.so.6 => /lib64/libc.so.6 (0x00007fb782402000)
>>>> /lib64/ld-linux-x86-64.so.2 (0x000003ad6c00000)
>>>> 
>>>> sys.version = '2.6.6 (r266:84292, Nov 21 2013, 10:50:32) \n[GCC 4.4.7 
>>>> 21020313 (Red Hat 4.4.7-4)]'
>>>> sys.prefix = '/usr'
>>>> 
>>>> 
>>>> Justin
>>>> 
>>>> On Tuesday, October 13, 2015 at 11:29:00 PM UTC-4, Graham Dumpleton wrote:
>>>> Are you using a Python virtual environment and are you installing Django 
>>>> into the Python virtual environment if you are, or is Django installed 
>>>> into system wide Python installation?
>>>> 
>>>> Also, check what version of Python mod_wsgi is actually compiled for by 
>>>> running checks in:
>>>> 
>>>> https://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Shared_Library
>>>>  
>>>> <https://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Shared_Library>
>>>> 
>>>> https://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Installation_In_Use
>>>>  
>>>> <https://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Installation_In_Use>
>>>> 
>>>> What do you get?
>>>> 
>>>> Graham
>>>> 
>>>>> On 14 Oct 2015, at 12:59 pm, Justin Martin <jwmar...@ <>gmail.com 
>>>>> <http://gmail.com/>> wrote:
>>>>> 
>>>>> I'm trying to get a stand alone server up and running and running into 
>>>>> some difficulties. I'm receiving the error below. I'm also not too 
>>>>> familiar with django and mod_wsgi in general so this might be a rookie 
>>>>> mistake.
>>>>> 
>>>>> I'm running RedHat 6.6, apache 2.2.15, django 1.6.1, python 2.6.6, 
>>>>> mod_wsgi 3.2
>>>>> 
>>>>> mod_wsgi(pid=<PID>): Target WSGI script '/path/to/my/application/wsgi.py' 
>>>>> cannot be loaded as Python module.
>>>>> mod_wsgi(pid=<PID>): Exception occurred process WSGI script 
>>>>> 'path/to/my/application/wsgi.py'.
>>>>> Traceback (most recent call list): File /path/to/my/application/wsgi.py, 
>>>>> line 14 in <module> From django.core.wsgi import get_wsgi_application 
>>>>> ImportError: no module name django.core.wsgi
>>>>> 
>>>>> 
>>>>> When I run it as python wsgi.py it doesn’t seem to have an issue. 
>>>>> 
>>>>> I will also put my .conf files below in case they are needed. I didn't 
>>>>> edit the httpd.conf file but instead created a seperate conf file.
>>>>> 
>>>>> /etc/httpd/conf.d/myapplication.conf
>>>>> Alias /static/ /path/to/myapplication
>>>>> 
>>>>> <Directory /path/to/myapplication>
>>>>> Order deny,allow
>>>>> Allow from all
>>>>> </Directory>
>>>>> 
>>>>> WSGIScriptAlias / /path/to/myapplication/wsgi.py
>>>>> WSGIPythonPath /path/to
>>>>> 
>>>>> <Directory /path/to/myapplication>
>>>>> <Files wsgi.py>
>>>>> Order deny,allow
>>>>> Allow from all
>>>>> </Files>
>>>>> </Directory>
>>>>> 
>>>>> /etc/httpd/conf.d/wsgi.conf
>>>>> <IfModule !wsgi_module>
>>>>> LoadModule wsgi_module modules/mod_wsgi.so
>>>>> </IfModule>
>>>>> 
>>>>> The weird thing is it is up and running on a few other servers with the 
>>>>> same layout but those work and this one doesn't. I've been trying to come 
>>>>> up with ideas but I'm kind of stuck and it might come to do with my lack 
>>>>> of knowledge of mod_wsgi and django.
>>>>> 
>>>>> Thanks for any and all assistance.
>>>>> 
>>>>> -- 
>>>>> 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 modwsgi+u...@ <>googlegroups.com <http://googlegroups.com/>.
>>>>> To post to this group, send email to mod...@ <>googlegroups.com 
>>>>> <http://googlegroups.com/>.
>>>>> Visit this group at http://groups.google.com/group/modwsgi 
>>>>> <http://groups.google.com/group/modwsgi>.
>>>>> For more options, visit https://groups.google.com/d/optout 
>>>>> <https://groups.google.com/d/optout>.
>>>> 
>>>> 
>>>> -- 
>>>> 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] 
>>>> <mailto:[email protected]>.
>>>> To post to this group, send email to [email protected] 
>>>> <mailto:[email protected]>.
>>>> Visit this group at http://groups.google.com/group/modwsgi 
>>>> <http://groups.google.com/group/modwsgi>.
>>>> For more options, visit https://groups.google.com/d/optout 
>>>> <https://groups.google.com/d/optout>.
>>> 
>>> 
>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "modwsgi" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/modwsgi/ZnHn8AYnAbg/unsubscribe 
>>> <https://groups.google.com/d/topic/modwsgi/ZnHn8AYnAbg/unsubscribe>.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> [email protected] 
>>> <mailto:[email protected]>.
>>> To post to this group, send email to [email protected] 
>>> <mailto:[email protected]>.
>>> Visit this group at http://groups.google.com/group/modwsgi 
>>> <http://groups.google.com/group/modwsgi>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> <https://groups.google.com/d/optout>.
>>> 
>>> -- 
>>> 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] 
>>> <mailto:[email protected]>.
>>> To post to this group, send email to [email protected] 
>>> <mailto:[email protected]>.
>>> Visit this group at http://groups.google.com/group/modwsgi 
>>> <http://groups.google.com/group/modwsgi>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> <https://groups.google.com/d/optout>.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "modwsgi" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/modwsgi/ZnHn8AYnAbg/unsubscribe 
>> <https://groups.google.com/d/topic/modwsgi/ZnHn8AYnAbg/unsubscribe>.
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] 
>> <mailto:[email protected]>.
>> To post to this group, send email to [email protected] 
>> <mailto:[email protected]>.
>> Visit this group at http://groups.google.com/group/modwsgi 
>> <http://groups.google.com/group/modwsgi>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
>> 
>> -- 
>> 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] 
>> <mailto:[email protected]>.
>> To post to this group, send email to [email protected] 
>> <mailto:[email protected]>.
>> Visit this group at http://groups.google.com/group/modwsgi 
>> <http://groups.google.com/group/modwsgi>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "modwsgi" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/modwsgi/ZnHn8AYnAbg/unsubscribe 
> <https://groups.google.com/d/topic/modwsgi/ZnHn8AYnAbg/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/modwsgi 
> <http://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/modwsgi 
> <http://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

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