WebFaction
Community site: login faq

Getting a 502 bad gateway problem on a recently updated (from Django 1.3 to 1.5) wsgi/Django app.

Here's my httpd.conf:

ServerRoot "/home/xxxx/webapps/xxxx_d15/apache2"

LogLevel info

LoadModule dir_module        modules/mod_dir.so
LoadModule env_module        modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module       modules/mod_mime.so
LoadModule rewrite_module    modules/mod_rewrite.so
LoadModule setenvif_module   modules/mod_setenvif.so
LoadModule wsgi_module       modules/mod_wsgi.so

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /home/xxxx/logs/user/access_xxxx_d15.log combined
ErrorLog /home/xxxx/logs/user/error_xxxx_d15.log
KeepAlive Off
Listen 34368
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIDaemonProcess xxxx_d15 processes=2 threads=12 python-path=/home/xxxx/webapps/xxxx_d15:/home/xxxx/webapps/xxxx_d15/lib/python2.7
WSGIProcessGroup xxxx_d15
WSGIRestrictEmbedded On
WSGILazyInitialization On
WSGIScriptAlias / /home/xxxx/webapps/xxxx_d15/xxxx.wsgi

And here's my xxxx.wsgi:

import os
import sys

sys.path.insert(0, '/home/xxxx/wepapps/xxxx_d15')
sys.path.insert(0, '/home/xxxx/webapps/xxxx_d15/xxxx')

from django.core.handlers.wsgi import WSGIHandler

os.environ['DJANGO_SETTINGS_MODULE'] = 'xxxx.settings'
application = WSGIHandler()

What's odd is that this works on another server I have. This server has a previous app (named 'xxxx' w/out the '_d15' suffix) that also worked. This is a newly created Django 1.5 app (on WebFaction) that I'm dropping my existing (code-updated) Django app into. I'm fairly confident that my code is fine. It's running on a Django 1.5 app on another server.

Right now I'm getting a 502 bad gateway error on this one. Logging doesn't seem to be providing much help here:

[Sun Sep 22 17:15:18 2013] [notice] caught SIGTERM, shutting down
[Sun Sep 22 17:15:23 2013] [warn] mod_wsgi: Compiled for Python/2.7.3.
[Sun Sep 22 17:15:23 2013] [warn] mod_wsgi: Runtime using Python/2.7.5.
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18993): Starting process 'xxxx_d15' with threads=12.
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18993): Initializing Python.
[Sun Sep 22 17:15:23 2013] [notice] Apache/2.2.17 (Unix) mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18994): Starting process 'xxxx_d15' with threads=12.
[Sun Sep 22 17:15:23 2013] [info] Server built: Aug 30 2012 16:40:14
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18994): Initializing Python.
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18993): Attach interpreter ''.
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18994): Attach interpreter ''.
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18993): Adding '/home/xxxx/webapps/xxxx_d15' to path.
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18993): Adding '/home/xxxx/webapps/xxxx_d15/lib/python2.7' to path.
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18994): Adding '/home/xxxx/webapps/xxxx_d15' to path.
[Sun Sep 22 17:15:23 2013] [info] mod_wsgi (pid=18994): Adding '/home/xxxx/webapps/xxxx_d15/lib/python2.7' to path.

Baffled at the moment here. Not seeing ANYTHING wrong nor any messages that help.

asked 22 Sep '13, 12:33

ccuilla
1139
accept rate: 0%


The 502 error indicates that your app's Apache instance is not running, or maybe it is listening on the wrong port. Take a look at your ~/webapps/xxxx_d15/apache2/conf/httpd.conf file and make sure that your "Listen" line is using the port number that was assigned to you in the WebFaction Control Panel. Then run ~/webapps/xxxx_d15/apache2/bin/restart.

Let me know if this does not solve the issue.

~Christopher S, WebFaction Support

permanent link

answered 22 Sep '13, 12:55

likebike
3366
accept rate: 28%

Doh! That was it. Thanks. Should have thought of that. Thanks so much!

(22 Sep '13, 13:01) ccuilla

You're welcome! Glad I could help. :)

(22 Sep '13, 13:05) likebike
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×225
×62
×21

question asked: 22 Sep '13, 12:33

question was seen: 4,246 times

last updated: 22 Sep '13, 13:05

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM