ec2 using bitnami djangostack: application never loads; browser just hangs

150 views
Skip to first unread message

Dylan Bumford

unread,
Jan 22, 2014, 11:49:07 AM1/22/14
to django...@googlegroups.com
I used the Bitnami Djangostack AMI to set up a Django environment with apache2 and mod_wsgi on a free instance provided by Amazon's EC2. The django app is installed at /opt/bitnami/apps/django/django_projects/mysite, alongside the default Project application that comes with the stack. The app runs on my local computer on the development server without issue. When I transferred the app to the server, I ran the collectstatic script to copy all of the static files to mysite/static, and configured the server to serve STATIC_ROOT at STATIC_URL (settings and configuration details are reported below). As best I can make out, I've configured everything in accordance with the Django documentation and modwsgi documentation.

When I point my browser to the server's public address, I see the bitnami startup page, but when I point to the subdirectory mapped to the application, the browser just hangs. It acts as if it's loading a website, spins the little wheel to tell you it's loading a website, and says 'Waiting for xx.xxx.xxx.xxx..." But nothing ever happens. There are no errors reported in /opt/bitnami/apache2/logs/error_log. But If I point instead to a random subdirectory that doesn't exist, I get a 404 page. If I point to the static subdirectory, I get a 403 Forbidden page. If I purposefully add a bug to any of the python code (in e.g. mysite/mysite/urls.py or mysite/myapp/views.py), I get a 500 Internal Server Error and a message in the error_log with the expected python stack trace.

If anyone has any suggestions, I would obviously be very grateful. I'm pretty new to this.

Here are the relevant parts of my configuration files.


/opt/bitnami/apache2/conf/httpd.conf

ServerRoot "/opt/bitnami/apache2"
Listen 80
<IfModule unixd_module>
User daemon
Group daemon
</IfModule>
ServerName localhost:80
DocumentRoot "/opt/bitnami/apache2/htdocs"
<Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/bitnami/python
Include "/opt/bitnami/apps/django/conf/mysite.conf"


/opt/bitnami/apps/django/conf/mysite.conf

Alias /static "opt/bitnami/apps/django/django_projects/mysite/static"

<Directory 'opt/bitnami/apps/django/django_projects/mysite/static'>
    Order deny,allow
    Allow from all
</Directory>

<Directory 'opt/bitnami/apps/django/lib/python2.7/site-packages/django/contrib/'>
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
</Directory>

WSGIScriptAlias /mysite "opt/bitnami/apps/django/scripts/mysite.wsgi"
WSGIPythonPath 'opt/bitnami/apps/django/django_projects/mysite/'

<Directory 'opt/bitnami/apps/django/scripts'>
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
</Directory>


/opt/bitnami/apps/django/scripts/mysite.wsgi

import os, sys

sys.path.append('/opt/bitnami/apps/django/lib/python2.7/site-packages/')
sys.path.append('/opt/bitnami/apps/django/django_projects')
sys.path.append('/opt/bitnami/apps/django/django_projects/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi

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


/opt/bitnami/apps/django/django_projects/mysite/mysite/settings.py

STATIC_ROOT = '/home/bitnami/apps/django/django_projects/mysite/static/'
STATIC_URL = '/static/'

Andreas Kuhne

unread,
Jan 22, 2014, 12:26:13 PM1/22/14
to django...@googlegroups.com
1. Have you checked all of the access logs and error logs when the app is started? Is your request getting served by modwsgi, or is it stuck in apache?
2. Start the application with DEBUG=True in settings, to see if you get any information from the app.

Thats where I'd start.

Regards,

Andréas Kühne


2014/1/22 Dylan Bumford <dbum...@gmail.com>

--
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/30d5dba3-a001-4dae-b8be-6ea7a575037e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dylan Bumford

unread,
Jan 22, 2014, 10:49:10 PM1/22/14
to django...@googlegroups.com
Thanks. I've checked apache's error_log, and it doesn't report anything unusual. The access_log reports about four hundred GET requests that look sort of like this:

10.73.205.233 - - [22/Jan/2014:18:07:34 -0500] "GET /img/ami-lower-container.png HTTP/1.1" 304 -
10.73.205.233 - - [22/Jan/2014:18:07:34 -0500] "GET /img/ami-list-item.png HTTP/1.1" 304 -

The last two lines are:

201.249.174.162 - - [22/Jan/2014:18:09:19 -0500] "HEAD / HTTP/1.0" 200 -
120.192.101.153 - - [22/Jan/2014:19:21:28 -0500] "GET /manager/html HTTP/1.1" 404 210

I don't know what other logs to check. When I run the app in DEBUG=True, I don't see any difference. If I introduce an artificial bug in /mysite/mysite/urls.py, it reports the bug through the Django debugging page (and also in error_log). But when I remove the bug, it's back to endless waiting. How can I tell if the request is making it to modwsgi or it's stuck in apache? 

Dylan

victoria

unread,
Feb 4, 2014, 10:50:04 AM2/4/14
to django...@googlegroups.com
Hi,

I'm sorry you are finding issues with the Bitnami image. I just saw
this, sorry if it is too late. Which version are you using? Can you
check if the django.conf file (apps/django/conf/django.conf) is
overwriting your /static alias? Also did you give permission to the
daemon user to read your project?

Best regards,

Victoria.
> https://groups.google.com/d/msgid/django-users/69f2e2fd-b912-4dea-836a-c5f35fea9e25%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages