1

私は Web プログラミングの初心者なので、構成に非常に単純なものが欠けていることを期待しています。助けていただければ幸いです。(私の英語も許してください - へー)

だからここにあります:私はFlaskの私の小さなアプリにいて、すべてがうまくいきます. 特に、私はFlask-Adminをいじっています:

123.45.67.8:8080/管理者/

作業中の管理パネルを返します...組み込みサーバーからnginx / uWSGIにURLを切り替えるとすぐに

www.mywebsite.com/admin/

私に404を与えます...しかし、Flask-Admin部分についてのみ、他のすべてが完全に機能します!

次のコマンドで uWSGI を開始します uwsgi --ini /path/to/myweb_uwsgi.ini

myweb_uwsgi.ini

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

#python module to import
app = myweb
module = %(app)

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

#socket file's location
socket = /var/www/myweb/%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 = app

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

これは私のnginx .confファイルです

server {
    listen      80;
    server_name localhost;
    charset     utf-8;
    client_max_body_size 75M;

    location / { try_files $uri @yourapplication; }
    location @yourapplication {
        include uwsgi_params;
        uwsgi_pass unix:/var/www/myweb/myweb_uwsgi.sock;
    }
}

uWSGI iniファイルに何かが欠けていると確信していますが、それを理解できません...

4

1 に答える 1

1

The reason this happens is that the app isn't initialized. Try moving the admin.Admin() initialization block away from the main function as well as adding the views. This is silly but not in the docs.

于 2015-09-22T20:20:01.523 に答える