-
Notifications
You must be signed in to change notification settings - Fork 1
uWSGI development tests
Adrian Wilke edited this page Mar 1, 2022
·
1 revision
Solution:
- Created python script to start flask
- Did not use virtual environment
sudo apt-get install uwsgi
cd /opt/embeddings.cc
uwsgi -s /tmp/embeddings.sock --manage-script-name --mount /embeddings=webservice_public:app
*** WARNING: you are running uWSGI without its master process manager ***
uwsgi -s /tmp/embeddings.sock --manage-script-name --master --mount /embeddings=webservice_public:app
!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!
no request plugin is loaded, you will not be able to manage requests.
you may need to install the package for your language of choice, or simply load it with --plugin.
!!!!!!!!!!! END OF WARNING !!!!!!!!!!
. /opt/anaconda3/etc/profile.d/conda.sh
sudo apt-get install uwsgi-plugin-python3
sudo apt-get install python3-uwsgidecorators
uwsgi -s /tmp/embeddings.sock --plugin python3 --manage-script-name --master --mount /embeddings=webservice_public:app
mounting webservice_public:app on /embeddings
Traceback (most recent call last):
File "./webservice_public/__init__.py", line 4, in <module>
from flask import Flask, request, current_app, jsonify, render_template
ModuleNotFoundError: No module named 'flask'
unable to load app 0 (mountpoint='/embeddings') (callable not found or import error)
conda info --envs
-> /opt/anaconda3/envs/embeddings
uwsgi -s /tmp/_embeddings.sock --plugin python3 --manage-script-name --master --mount /embeddings=webservice_public:app --virtualenv=/opt/anaconda3/envs/embeddings
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
conda install -c conda-forge uwsgi
uwsgi -s /tmp/_embeddings.sock --manage-script-name --mount /embeddings=webservice_public:app --master --plugin python3 --virtualenv /opt/anaconda3/envs/embeddings
which uwsgi
/opt/anaconda3/envs/embeddings/bin/uwsgi
whereis uwsgi
/usr/bin/uwsgi -s /tmp/_embeddings.sock --manage-script-name --mount /embeddings=webservice_public:app --master --plugin python3 --virtualenv /opt/anaconda3/envs/embeddings
which python
/opt/anaconda3/envs/embeddings/bin/python
/usr/bin/uwsgi -s /tmp/____embeddings.sock --manage-script-name --mount /embeddings=webservice_public:app --master --plugin python3 --virtualenv /opt/anaconda3/envs/embeddings
-------------------- waitress test --------------------
pip install waitress
waitress-serve --call 'webservice_public:app'
There was an exception (ModuleNotFoundError) importing your module. It had these arguments: 1. No module named 'flask'
conda install -c conda-forge uwsgi
https://linuxtut.com/en/e170fead91261621b054/
https://vladikk.com/2013/09/12/serving-flask-with-nginx-on-ubuntu/
pip install uwsgi
https://uwsgi-docs.readthedocs.io/en/latest/Install.html
sudo apt-get remove uwsgi
sudo apt-get install build-essential python
sudo apt-get install -y python-dev
https://decovar.dev/blog/2019/11/03/nginx-uwsgi-python-scripts/
cd /tmp/build
https://github.com/unbit/uwsgi/archive/refs/tags/2.0.20.zip
unzip 2.0.20.zip
python uwsgiconfig.py --build core
gcc: error: /opt/anaconda3/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.a: No such file or directory
conda install -c conda-forge libpython-static
sudo python uwsgiconfig.py --build
sudo mv uwsgi-2.0.20/ /opt/
/usr/bin/uwsgi -s /tmp/____embeddings.sock --manage-script-name --mount /embeddings=webservice_public:app --master --plugin python3 --plugin-dir=/opt/uwsgi-2.0.20/
https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#security-and-availability
pip install uwsgi
python -m site # https://stackoverflow.com/a/46071447
uwsgi --plugin python3 --wsgi-file wsgi.py --callable application -s /tmp/_____embeddings.sock -H /opt/anaconda3
uwsgi --plugin python3 --wsgi-file wsgi.py --callable application -H /opt/anaconda3 --http :90
uwsgi: option --http' is ambiguous
uwsgi --plugin python3 -H /opt/anaconda3 --mount /=wsgi.py --socket /tmp/_____embeddings.sock --chmod-socket=777 --thunder-lock
uwsgi --plugin python3 -H /opt/anaconda3 --mount /=webservice_public/wsgi.py --socket /tmp/_____embeddings.sock --chmod-socket=777 --thunder-lock
-> worked :)