django 1.8 and wsgi_mod

117 views
Skip to first unread message

dk

unread,
Apr 27, 2015, 12:53:16 PM4/27/15
to django...@googlegroups.com
we decided to test django 1.8,  using python manage.py runserver works great.  but now the production wsgi stop working,
I remember there was a change between version 1.6 and 1.7. 
this is my code.   Did it something change?

import os
import sys
sys.path.append("/code/projects/my_web")
sys.path.append("/code/projects/my_web/core") # path to the project
os.environ["DJANGO_SETTINGS_MODULE"]= "core.settings"

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

#this is the way for django 1.6
#import django.core.handlers.wsgi
#application = django.core.handlers.wsgi.WSGIHandler()

thanks guys.

Abhaya Agarwal

unread,
Apr 28, 2015, 2:28:04 AM4/28/15
to django...@googlegroups.com
This looks fine. Are there any errors in the web server logs?

Regards,
Abhaya

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2d130a53-d9e4-404e-bf79-ba4f1df492dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-------------------------------------------------
blog: http://abhaga.blogspot.com
Twitter: http://twitter.com/abhaga
-------------------------------------------------
Message has been deleted
Message has been deleted

dk

unread,
Apr 28, 2015, 12:10:05 PM4/28/15
to django...@googlegroups.com

I check the apache httpd log  and do get this

[Tue Apr 28 10:33:49.982311 2015] [:error] [pid 18060] [client 10.35.0.91:61408]     from django.apps import apps
[Tue Apr 28 10:33:49.982336 2015] [:error] [pid 18060] [client 10.35.0.91:61408] ImportError: No module named apps
[Tue Apr 28 10:33:52.595973 2015] [:error] [pid 18061] [client 10.35.0.91:61410] mod_wsgi (pid=18061):
Target WSGI script '/code/projects/my_web/wsgi/my.wsgi' cannot be loaded as Python module.
[Tue Apr 28 10:33:52.596033 2015] [:error] [pid 18061] [client 10.35.0.91:61410] mod_wsgi (pid=18061):
Exception occurred processing WSGI script '/code/projects/my_web/wsgi/my.wsgi'.

I think is the No module named apps is causing this =(



this is the folder structure.
├── my_web
│   ├── core (i rename this so i know where all the original django files are)
│   │   ├── __init__.py
│   │   ├── settings.py
│   │   ├── urls.py
│   │   ├── urls.pyc
│   │   ├── wsgi.py
│   ├── db.sqlite3
│   ├── __init__.py
│   ├── manage.py
│   ├── mes (this is my only app i did)
│   │   ├── admin.py
│   │   ├── __init__.py
│   │   ├── migrations
│   │   ├── models.py
│   │   ├── templates
│   │   │   └── mes
│   │   ├── urls.py
│   │   ├── views.py
│   ├── static
│   │   ├── images
│   │   ├── style
│   │   │   └── style.css
│   ├── templates
│   │   ├── main_page.html
│   │   └── main_template.html
│   └── wsgi
│       ├── idrac.wsgi (here is the wsgi)
│       ├── __init__.py
│       └── readme.txt
└── __init__.py


and this is how i activated the app
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'mes',
)

everything works fine if i do it from manage.py runserver

Abhaya Agarwal

unread,
May 7, 2015, 2:46:53 PM5/7/15
to django...@googlegroups.com
On Tue, Apr 28, 2015 at 9:40 PM, dk <dem...@gmail.com> wrote:

I check the apache httpd log  and do get this

[Tue Apr 28 10:33:49.982311 2015] [:error] [pid 18060] [client 10.35.0.91:61408]     from django.apps import apps
[Tue Apr 28 10:33:49.982336 2015] [:error] [pid 18060] [client 10.35.0.91:61408] ImportError: No module named apps
[Tue Apr 28 10:33:52.595973 2015] [:error] [pid 18061] [client 10.35.0.91:61410] mod_wsgi (pid=18061):
Target WSGI script '/code/projects/my_web/wsgi/my.wsgi' cannot be loaded as Python module.
[Tue Apr 28 10:33:52.596033 2015] [:error] [pid 18061] [client 10.35.0.91:61410] mod_wsgi (pid=18061):
Exception occurred processing WSGI script '/code/projects/my_web/wsgi/my.wsgi'.

I think is the No module named apps is causing this =(

It certainly is. It is hard to say anything more without looking at the actual code/setup. But since runserver works, perhaps your production environment is pointing to an older version of Django?

Regards,
Abhaya

Luis Zárate

unread,
May 8, 2015, 12:10:54 AM5/8/15
to django...@googlegroups.com
Your server log said this (loading my.wsgi)

Exception occurred processing WSGI script '/code/projects/my_web/wsgi/my.wsgi'.


But your structure said that wsgi file is called different (idrac.wsgi).

Other thing, call core your app is not a good idea, do it if you understand well how python import work, otherwise it is a pain in the ask
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFPF63SGNtRKwaWThd%2BS47dz9joGxqfg%3D%2BXuB4UOfKr0g0Erbw%40mail.gmail.com.

> For more options, visit https://groups.google.com/d/optout.
>

--
"La utopía sirve para caminar" Fernando Birri



Reply all
Reply to author
Forward
0 new messages