我想我的主要问题是我不知道文件层次结构应该是什么样子的?到目前为止,我一直在按照Grinberg在他的“Flask开发”书中的教程进行操作。所以我的文件结构大致如下:
--manage.py ( Flask's Script extension script)
--app/ ( application folder as a package)
--virtual_env
我不确定我搞砸了什么,但现在当我尝试使用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 ***
编辑:
像这样启动它可以正常工作:
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;
}
}
}