Welcome! Log In Create A New Profile

Advanced

Re: Flask app with virtual Python environment in Unit 1.1 ?

Valentin V. Bartenev
April 29, 2018 11:08AM
On Sunday, 29 April 2018 17:10:08 MSK Ralph Seichter wrote:
[..]
> Here's my minimal wsgi.py:
>
> # /var/www/myapp/wsgi.py
> import mypackage
> if __name__ == "__main__":
> mypackage.run()
>
> The Flask application object is defined in mypackage.__init__.py:
>
> app = Flask(__name__)
>
> NGINX Unit does not know about the virtual Python environment at this
> time, and I don't know how I can set the required library paths. Can
> somebody please point me in the right direction?
>
[..]


You can set a path to Python virtual environment using the "home"
parameter of application object.

"myapp": {
"type": "python",
"module": "wsgi",
"user": "nginx",
"group": "nginx",
"path": "/var/www/myapp",
"home": "/path/to/your/venv/directory"
}


Please also note that your application callable need to be named
"application" (not "app"). That can be easily achievable by:

application = app

in your wsgi.py

wbr, Valentin V. Bartenev





_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Flask app with virtual Python environment in Unit 1.1 ?

Ralph Seichter April 29, 2018 10:12AM

Re: Flask app with virtual Python environment in Unit 1.1 ?

Valentin V. Bartenev April 29, 2018 11:08AM

Re: Flask app with virtual Python environment in Unit 1.1 ?

Ralph Seichter April 29, 2018 12:04PM

Re: Flask app with virtual Python environment in Unit 1.1 ?

Valentin V. Bartenev April 29, 2018 05:04PM

Re: Flask app with virtual Python environment in Unit 1.1 ?

Ralph Seichter April 30, 2018 05:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 314
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready