我想我的主要问题是我不知道,文件层次结构应该如何?到目前为止,我在他的"烧瓶开发"一书中关注了格林伯格的教程.所以我喜欢:
--manage.py ( Flask's Script extension script)
--app/ ( application folder as a package)
--virtual_env
Run Code Online (Sandbox Code Playgroud)
并且不确定我搞砸了什么,但现在当我用uwsgi命令尝试任何东西时,它会说以下错误:
current working directory: /home/gaucan/temp/my_app
detected binary path: /usr/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
*** WARNING: you are running uWSGI without its master process manager ***
Run Code Online (Sandbox Code Playgroud)
编辑:像这样工作开始:
uwsgi --http :9090 -w manage:app --enable-threads
这工作......在manage.py我有线:
app=create_app('default')
所以这几乎就是我想我需要做的...
但我仍然无法得到上面的警告...我正在运行uwsgi没有它的主过程管理器......是否可以?或者我做错了什么?
这只是创建/etc/nginx/nginx.conf文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
sendfile on;
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 500;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript
application/x-javascript
application/atom+xml;
# Configuration containing list of application servers
upstream uwsgicluster {
server 127.0.0.1:8080;
# server 127.0.0.1:8081;
# ..
# .
}
# Configuration for Nginx
server {
# Running port
listen 80;
# Settings to by-pass for static files
location ^~ /static/ {
# Example:
# root /full/path/to/application/static/file/dir;
root /app/static/;
}
# Serve a static file (ex. favico) outside static dir.
location = /favico.ico {
root /app/favico.ico;
}
# Proxying connections to application servers
location / {
include uwsgi_params;
uwsgi_pass uwsgicluster;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
Run Code Online (Sandbox Code Playgroud)
}
Mig*_*uel 14
这可能与您安装uwsgi的方式有关.这个警告:
!!! no internal routing support, rebuild with pcre support !!!
Run Code Online (Sandbox Code Playgroud)
与您的应用程序无关,它与您的uwsgi二进制文件无关.
基本上它表示uwsgi的一部分尚未在您使用的二进制文件中启用.运行Flask应用程序不需要该特定功能,因此您可以忽略该警告.但是,如果您想了解更多信息,请参阅此问题以获取有关此问题以及如何解决此问题的一些信息.
现在,关于这个其他警告:
*** WARNING: you are running uWSGI without its master process manager ***
Run Code Online (Sandbox Code Playgroud)
我认为您缺少--master选项,以启用prefork服务器.