2017-10-02 7 views
1

私が最近走った問題は、サブディレクトリからフラスコアプリを実行する方法でした。たとえば、mysite.com/myappは1つのフラスコアプリを実行し、mysite.com/some_otherは別のスクリプトを完全に実行することができます。 mysite.com/からフラスコのアプリケーションを実行する方法については、Web上に多数の良いチュートリアルがありますが、私がサブディレクトリの問題を解決するために行ったとき、古い情報がいくつか見つかりました。nginxとuwsgiを使ってサブディレクトリからフラスコアプリを提供する方法

答えて

1

私が最初にこれを調べ始めたとき、uwsgi_param SCRIPT_NAME /mysubdiruwsgi_modifier1 30をnginx設定ファイルに入れなければならないと提唱している多くのサイトが見つかりました。どうやら、これは2017(nginx nginx/1.10.3とuwsgi 2.0.15)の時代遅れの情報です。

以下の設定ファイルは、サブディレクトリに必要なものです。

次に、uwsgiのiniファイルにいくつかの項目を追加する必要があります。私のものはpythonファイルと同じディレクトリに格納されています。これらは追加する行です。

## Settings to deal with the subdirectory 
manage-script-name = true 
mount=/mysubdir=wsgi.py 

だから、完全な.iniファイルは今、この

[uwsgi] 
module = wsgi:application 
#location of log files 
logto = /var/log/uwsgi/app/%n.log 
master = true 
processes = 5 
## Settings to deal with the subdirectory 
manage-script-name = true 
mount=/myapp=wsgi.py 
socket = myapp.sock 
chmod-socket = 660 
vacuum = true 
die-on-term = true 
のように見えます
関連する問題