0

I tried to configure WSGI with wsgi.py in my project folder

import os
import sys

sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR']))

os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'

virtenv = os.environ['OPENSHIFT_HOMEDIR'] + 'python/virtenv/'
os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib/python2.7/site-packages')

virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
    execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
    pass
#
# IMPORTANT: Put any additional includes below this line.  If placed above this
# line, it's possible required libraries won't be in your searchable path
#

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

but I have Internal Server Error 500

[Wed Jun 08 16:42:46 2016] [error] [client 127.9.155.129] ImportError: No module named project.settings

and I have this module available in my projet.

I tried some help like :

Can you help my to launch my app on OpenShift

Thanks

Community
  • 1
  • 1
general03
  • 855
  • 1
  • 10
  • 33
  • [This](http://stackoverflow.com/questions/11688819/how-to-configure-django-on-openshift) question might help you. – Natsukane Jun 08 '16 at 21:11
  • Thanks @Natsukane for the link but I refered already this link in my post. And the answer does not solve my issue – general03 Jun 08 '16 at 21:16
  • My bad, I didn't check that link and assumed it linked to another website instead of SO. In any case, the code in your example and that link is different - did you get the same error when testing that solution? Also, please include the code from your setup.py in your question. – Natsukane Jun 08 '16 at 21:35
  • Also include what is the value for os.environ['OPENSHIFT_REPO_DIR'] and the full path for the project.settings. It seems like project.settings is not available under the sys path by the time it is getting evaluated. – Praveen Yalagandula Jun 08 '16 at 21:50
  • @Natsukane you want the setup.py under project folder ? – general03 Jun 09 '16 at 05:52
  • @PraveenYalagandula how do you include the full path of my project ? – general03 Jun 09 '16 at 05:55

1 Answers1

0

I had on the top of wsgi.py

os.path.join(os.environ['OPENSHIFT_HOMEDIR'], 'app-root/repo')

and I didn't have this error ! And I also put all my code under folder which have the name of my project in order to match

os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
general03
  • 855
  • 1
  • 10
  • 33