在 Ubuntu 上使用 Nginx 部署 Flask 應用

原文地址:開源中國技術翻譯python


遇到的問題mysql

1.安裝mysql-python 出錯:mysql_config not found linux

解決:http://zhoujianghai.iteye.com/blog/1520666nginx

2.安裝PIL 出錯:No distributions at all found for PIL
sql

解決:Pillow代替PILshell

3.安裝xlml 出錯:error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
flask

解決:http://stackoverflow.com/questions/27130286/error-command-x86-64-linux-gnu-gcc-failed-with-exit-status-1-in-virtualenv ubuntu

4.配置完成後一直找不到程序入口,檢查發現uwsgi的配置文件須要和程序入口在同一目錄裏面,貼上我本身的配置文件和應用結構,方便之後查驗。緩存

[uwsgi]
#application's base folder
base = /var/www

#python module to import
sep = run
module = %(sep)

home = %(base)/flask
pythonpath = %(base)

#socket file's location
socket = /var/www/XBSEP/Core/%n.sock

#permissions for the socket file
chmod-socket    = 666

#the variable that holds a flask application inside the module imported at line #6
callable = sep

#location of log files
logto = /var/log/uwsgi/%n.log

5.每次重啓uwsgi時都須要先刪除run.pyc才能正常啓動。不然依舊會提示no module named run,如今還未找到解決方法。
app

6.IE緩存很是嚴重!

相關文章
相關標籤/搜索