Problems running beautifulsoup4 within Apache/mod_python/Django

I'm was trying to render an HTML-page on the fly using BeautifulSoup version 4 in Django (using Apache2 with mod_python). However, as soon as I pass any HTML-string to the BeautifulSoup constructor (see code below), the browser just hangs waiting for the webserver. I tried equivalent code in CLI and it works like a charm. So I'm guessing it's something related to BeautifulSoups environment, in this case Django + Apache + mod_python.

import bs4
import django.shortcuts as shortcuts

def test(request):
    s = bs4.BeautifulSoup('<b>asdf</b>')
    return shortcuts.render_to_response('test.html', {})

I have installed BeautifulSoup using pip, pip install beautifulsoup4. I tried to install BeautifulSoup3 using standard Debian packages, apt-get install python-beautifulsoup, and then the following equivalent code works fine (both from browser and CLI).

from BeautifulSoup import BeautifulSoup
import django.shortcuts as shortcuts

def test(request):
    s = BeautifulSoup('<b>asdf</b>')
    return shortcuts.render_to_response('test.html', {})

I have looked in Apaches access and error logs and they show no information what's happening to the request that gets stalled. I have also checked /var/log/syslog and /var/log/messages, but no further info.

Here's the Apache configuration I used:

<VirtualHost *:80>
    DocumentRoot /home/nandersson/src
    <Directory /home/nandersson/src>
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE app.settings
        PythonOption django.root /home/nandersson/src
        PythonDebug On
        PythonPath "['/home/nandersson/src'] + sys.path"
    </Directory>

    <Location "/media/">
        SetHandler None
    </Location>
    <Location "/app/poc/">
        SetHandler None
    </Location>
</VirtualHost>

I'm not sure how to debug this further, not sure if it's a bug or not. Anyone got ideas on how to get to the bottom of this or have run into similar problems?

Permissions for /var/www/html

I have a virtual CentOS server with GoDaddy, and I'm having trouble setting up the permissions for /var/www/html.

Users are not allowed to log in as root, or even add themselves to the root group, so here's the corner I've painted myself into:

  • I changed its owner using the following command (I used the user:group that was in httpd.conf):

    chown -R apache:apache /var/www/html
    
  • I added my own user to the apache group:

    usermod -a -G apache myuser
    
  • I changed the permissions:

    chmod 777 /var/www/html -R
    

This is the only way to give my SFTP account the ability to create, change, and delete files in /var/www/html. 777! (The SFTP account uses the same credentials as the ssh account, which means for all intents and purposes they're the same, right?)

I'm obviously new to Linux server admin, but this seems ridiculously insecure. Is there a better way to do all this?

Note The website I'm planning on putting up here will allow file uploads, cron jobs, etc., so I'm guessing that will complicate the necessary permissions as well. Is that correct?

Update Using 775 does not appear to work; I can upload/overwrite files, but when I just try to delete them, FileZilla gives me this error:

rm /var/www/html/index.php: permission denied

I have no idea why, but changing back to 777 "fixes" this.

wamp server does not start: Windows 7, 64Bit

I am trying to install wamp server (following is the exact setup name) on windows 7, 64Bit OS. But it never starts, icon stays in orange color meaning some services did not start.

wampserver2.2e-php5.3.13-httpd2.2.22-mysql5.5.24-x64

I have been searching from last 3hours but did not find any solution.

No skype, port 80 is not in use.

In windows services, when I try to start wampapache service manually, it throws following error:

Windows could not start the wampapache service on Local Computer. Error 1053: The service did not respond ot the start or control request in a timely fashion.

apache_error.log is empty.

Things use to work fine in windows XP.

May be this is a repeated thread, but I did go through similar posts in stackoverflow. But nothing worked!

Please help!!

What should I do when applicaiton response is slow?

I`m curious to know what kind of options are there when application return slow responses.Googling of slow HTTP response or else doesn't provide me some comprehensive answer.So let me ask here.

What is the your strategy to solve the problem?Which logs should I see?How can I analyze the logs?What kind of tool can I use for this purose(Ys-slow,jellybean,ganglia,etc)?What would you do when js,Apache or other server software,server capacity,SQL query or other databases query,etc seems to be the bottleneck?What is the most efficient way to see whether the application code has some bottleneck(when there are tone of source code and tone of activity)