python - flask在apache部署失败的问题
大家讲道理
大家讲道理 2017-04-18 10:10:33
0
1
412

python新人,最近要在centos6.5安装使用flask框架,在部署的时候出现了以下问题,对于apache基本是一窍不通.望各位能不吝赐教,学生先谢谢了..

先描述一下问题:
1.在centos6.5,python3.4,apache2.2的环境下部署flask的时候出现了一些问题,先贴一张apache的错误日志图和浏览器的错误画面

2.flask是全局pip安装的,贴一下图

3.再贴一张apache的主配置文件图

4.下面是wsgi的运行目录

5.下面是test.py和app.wsgi两个文件的内容

**
下面是环境描述
1.系统原先是python2.6.6,我升级到3.4,并且将/usr/bin/python链接到python3.4,在shell里面输入python,默认是进入python3.4.
2.flask,mod_wsgi都是用pip全局安装,没有用virtualenv环境。
3.写一个flask最简单的demo,就是图中的hello.py,在shell里面输入python hello.py,这个文件是正常运行,可以接收web请求。
4.在app.wsgi里面只写图中注释的部分,可以在浏览器显示出来 hello,wsgi 的提示
5.apache的配置是按照网上的教程自己瞎写的,不知道是不是这里出了问题。
**

大概问题就是这样,这里技术大牛多,想把这个东西弄好,顺便能多学点相关的知识是最好的,再次谢谢大家

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
黄舟

First of all, my answer is not exactly what you asked, but it can solve the problem. If you don’t like it, don’t complain.
Although mod_wsgi is officially recommended, gunicorn and uwsgi are actually widely used in production environments. Use mode_wsgi+apache There are very few, gunicorn (or uwsgi) + nginx (or apache) is the most common and simplest configuration. And as far as python is concerned, nginx is used more than apache. Even if you use apache, you only use the virtual host function of apache , it is better to use nginx directly. As for the detailed configuration of gunicorn or uwsgi, you can directly read the official documentation or Baidu or Google. The configuration is relatively simple. A project I maintain has a monthly activity of one million, and the uwsgi configuration only requires a dozen lines.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!