I have set up a sample testapp as described in "Can't deploy a simple Flask application on Webfaction" to get a basic webapp running.
Below is the code snippet and structure :
"On web faction server"
/home/<user>/webapps
ls
>> testapp ( <-- my testapp)
cd testapp
>> apache2 htdocs
cd htdocs
>> index.py testapp.py
my index.py file stored under htdocs is as below :
import sys
testapp = "/home/<user>/webapps/testapp/htdocs"
if not testapp in sys.path:
sys.path.insert(0, testapp)
from testapp import app as application
my testapp.py file stored under htdocs is as below :
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
My httpd.conf stored under /home//webapps/testapp/apache2/conf is as below :
ServerRoot "/home/<user>/webapps/testapp/apache2"
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/<user>/logs/user/access_testapp.log combined
DirectoryIndex index.py
DocumentRoot /home/<user>/webapps/testapp/htdocs
ErrorLog /home/<user>/logs/user/error_testapp.log
KeepAlive Off
Listen 24329
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIDaemonProcess testapp processes=5 python-path=/home/<user>/webapps/testapp /lib/python3.1 threads=1
WSGIProcessGroup testapp
WSGIRestrictEmbedded On
WSGILazyInitialization On
WSGIPythonPath /home/<user>/webapps/testapp/htdocs
WSGIScriptAlias / /home/<user>/webapps/testapp/htdocs/index.py
<Directory /home/<user>/webapps/testapp/htdocs>
AddHandler wsgi-script .py
ReWriteEngine on
RewriteBase /
WSGIScriptReloading On
</Directory>
I have my domain pointed to my project in webfaction. The default index.py was working prior to me overwriting with the new one as stated in the instructions.
Below are the details of my application in the control panel section on web faction :
testapp
Name testapp
Label mod_wsgi 3.4/Python 3.2
Machine
Web377
Description
mod_wsgi 3.4/Python 3.2
Port 24329
I have check the error_testapp.log under user's and see below :
[Mon Feb 04 07:45:05 2013] [notice] caught SIGTERM, shutting down
[Mon Feb 04 07:45:10 2013] [notice] Apache/2.2.17 (Unix) mod_wsgi/3.4 Python/3.2.3 configured -- resuming normal operations
[Mon Feb 04 07:57:14 2013] [notice] caught SIGTERM, shutting down
[Mon Feb 04 07:57:19 2013] [notice] Apache/2.2.17 (Unix) mod_wsgi/3.4 Python/3.2.3 configured -- resuming normal operations
On trying to launch the app from http:// <user>.webfactional.com/testapp/
I get "Site not Configured" message.
Can someone please shed light on what may be going wrong here.This is my first time with Flask and webfaction.Thanks in advance for your time.Please let me know if you need more details.