Sirion
Sirion

Reputation: 927

Openshift + django: 503 Service Unavailable + project root

I'm trying to set up openshift to publish my django project. I created a scalable python3.3 app with django preinstalled and I added postgres9.2 cartridge.

I found the dirs structure quite complicated but in the end I noticed that the default example project was located under apps-root/runtime/repo/wsgi/openshift/ so I moved all files from this directory to a folder named 'backup' and I pasted here my project.

Now when I visit my site I get:

503 Service Unavailable
No server is available to handle this request.

I read that this can be due to HAproxy. I tried to restart my app through Openshift Online Web Interface but I still get the same error.

So:

1) How can I solve this issue?

2) How can I change the root folder of my project from apps-root/runtime/repo/wsgi/openshift/ to the root of my git repo so that I don't have unwanted folder (i.e. /wsgi/openshift/) in my local and bitbucket repo?

UPDATE: looking at my logs I get:

==> python/logs/appserver.log <==
    server = server_class((host, port), handler_class)
File "/opt/rh/python33/root/usr/lib64/python3.3/socketserver.py", line 430, in __init__
    self.server_bind()
File "/opt/rh/python33/root/usr/lib64/python3.3/wsgiref/simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
File "/opt/rh/python33/root/usr/lib64/python3.3/http/server.py", line 135, in server_bind
    socketserver.TCPServer.server_bind(self)
File "/opt/rh/python33/root/usr/lib64/python3.3/socketserver.py", line 441, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use

If I visit HAProxy status page in Express table "Server Status" is DOWN both in "local-gear" and "backend" rows.

Upvotes: 1

Views: 1583

Answers (2)

green
green

Reputation: 226

I have the same issue and this was resolved after changing the haproxy.cfg.

    option httpchk GET /

Comment out that line in haproxy.cfg or else set it to

    option httpchk OPTIONS * HTTP/1.1\r\nHost:\ www    

where www is your app link. See http://haproxy.1wt.eu/download/1.4/doc/configuration.txt for detail if you want to know more about haproxy configuration. Hope it works

Upvotes: 5

niharvey
niharvey

Reputation: 2807

If you want to build django yourself you may might want to check out this thread as I think it will help How to configure Django on OpenShift?

If you want to use something prebuilt then check out the django quickstart here https://www.openshift.com/quickstarts/django

Upvotes: 0

Related Questions