Thank you very much for the answer Alfonso.
El lunes, 22 de enero de 2018, 13:23:28 (UTC+1), Graham Dumpleton escribió: > > Because you want to use Django there is no solution on Windows. > > Each instance of Django must run in a separate process or sub interpreter > context. > > Because numpy and associated maths/science libraries are implemented in a > way such that they do not work in sub interpreters, then you would have to > force the use of the first (main) Python interpreter context. > > The problem now is that can't do that for all Django sites as they can't > run together and must run separately. So you can't satisfy both > requirements. > > If you were running Linux and not Windows you would use separate daemon > process groups and run each Django site in separate processes, where each > runs in the first (main) Python interpreter context of the respective > processes. On Windows, daemon mode doesn't exist though, so you don't have > that choice. > > The only other things you might consider are: > > 1. If each Django site is basically the same, use the Django sites > framework to allow one instance of Django to serve all sites. This will > allow them to run together and you can run them in the first (main) Python > interpreter context to satisfy the limitation on numpy based libraries. > > 2. Use Linux instead of Windows. Windows isn't a very good platform for > running Python web applications with Apache anyway. > > 3. Consider using Docker and run each Django site in separate Linux > containers. > > Graham > > On 22 Jan 2018, at 7:55 pm, Alfonso Morente <[email protected] > <javascript:>> wrote: > > Hello, > > Version of Python: 3.5 > Version of Apache: 2.4 > Operating system: Windows Server 2008 > Error Python packages: scikit-learn > mod_wsgi: embedded-mode > > We are having deadlocks problems when using multiple wsgi applications, > and with an import to this package *from sklearn.features_extraction.text > import TfidfVectorizer *into one of the wsgi application. > > We have a virtual host, and the *httpd-vhosts.conf* is like that: > > <VirtualHost *:8081> > Alias /static "${SERVER_PATH}/static/" > Alias /ms/static "${SERVER_PATH}/ms/static/" > <Directory "${SERVER_PATH}/static"> > Require all granted > </Directory> > <Directory "${SERVER_PATH}/ms/static"> > Require all granted > </Directory> > > WSGIScriptAlias /ms1 "${SERVER_PATH}/ms/ms1/wsgi.py" > WSGIScriptAlias /ms2 "${SERVER_PATH}/ms/ms2/wsgi.py" > WSGIScriptAlias / "${SERVER_PATH}/wsgi.py" > > > <Directory "${SERVER_PATH}"> > <Files wsgi.py> > Require all granted > </Files> > </Directory> > > </VirtualHost> > > Each *wsgi.py* file has the same structure: > > > import os,sys > > project_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) > if project_path not in sys.path: > sys.path.append(project_path) > > os.environ["DJANGO_SETTINGS_MODULE"]='ms.ms1.settings' > > # This application object is used by any WSGI server configured to use this > # file. This includes Django's development server, if the WSGI_APPLICATION > # setting points here. > from django.core.wsgi import get_wsgi_application > application = get_wsgi_application() > > > > > *How could we configure the Apache server in order to access the three > wsgi applications and with no deadlocks?*Thanks, > Alfonso. > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] <javascript:> > . > Visit this group at https://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
