Hello World in mod_wsgi

后端 未结 1 1329
庸人自扰
庸人自扰 2020-12-16 14:40

After failing repeatedly in my quest to get my flask application to run on Apache using mod_wsgi I decided to try running the hello world example. Here is what

相关标签:
1条回答
  • 2020-12-16 14:50

    You need to use an absolute path, i.e. don't use ~. This works fine for me...

    [mpenning@tsunami public_html]$ sudo cat /etc/apache2/sites-available/wsgi_test
    <VirtualHost *:80>
        ServerName wsgihost
        DocumentRoot /home/mpenning/public_html
        WSGIScriptAlias / /home/mpenning/public_html/test.wsgi
    </VirtualHost>
    [mpenning@tsunami public_html]$
    

    First I set up a hostname in /etc/hosts, so I could ensure that I can mux on the hostname in the query...

    [mpenning@tsunami public_html]$ grep wsgihost /etc/hosts
    127.0.1.1       tsunami.foo.net  tsunami wsgihost
    [mpenning@tsunami public_html]$
    

    Restart apache, and issue a wget...

    [mpenning@tsunami public_html]$ wget http://wsgihost/
    --2012-08-29 05:50:26--  http://wsgihost/
    Resolving wsgihost... 127.0.1.1
    Connecting to wsgihost|127.0.1.1|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 12 [text/plain]
    Saving to: âindex.html.3â
    
    100%[======================================>] 12          --.-K/s   in 0s
    
    2012-08-29 05:50:26 (1.48 MB/s) - âindex.html.3â
    
    [mpenning@tsunami public_html]$ cat index.html
    Hello World![mpenning@tsunami public_html]$ #  <------
    
    0 讨论(0)
提交回复
热议问题