我已經設置了一個示例testapp,如「Can't deploy a simple Flask application on Webfaction」中所述,以運行一個基本的web應用程序。在web派系上部署一個簡單的應用程序應用程序
下面的代碼片段和結構:
「在網絡服務器派」
/home/<user>/webapps
ls
>> testapp (<-- my testapp)
cd testapp
>> apache2 htdocs
cd htdocs
>> index.py testapp.py
我下的htdocs存儲index.py文件如下:
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
我testapp在htdocs下存儲的.py文件如下:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
我在/ home //的webapps/testapp/apache2的/ conf目錄的httpd.conf存儲是如下:
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>
我有我的域名指向我的webfaction項目。按照說明中的說明,默認的index.py在我之前覆蓋新的index.py。
下面是我在控制面板部分的網絡應用派的細節:
testapp
Name testapp
Label mod_wsgi 3.4/Python 3.2
Machine
Web377
Description
mod_wsgi 3.4/Python 3.2
Port 24329
我檢查下用戶的error_testapp.log,看看下面:
[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
在努力啓動應用程序從http:// <用戶> .webfactional.com/testapp/
我得到「網站未配置」消息。
有人可以澄清什麼可能會出錯這裏。這是我第一次與燒瓶和webfaction.Thanks提前您的時間。請讓我知道如果您需要更多的細節。