Tuesday, August 29, 2017

Re: Deploy production django applications with Python2.7 and Python3.5 on same Apache web server



On Aug 28, 2017 11:51 PM, "BIJAL MANIAR" <bijalcm@gmail.com> wrote:

I tried serving both Python2.7 and Python3.5 based django applications through same Apache and it did not work.
Getting below error:

Traceback (most recent call last):
  File "C:/virtualenvs/ecst_venv_D111P36A22M51\lib\site.py", line 67, in <module>
    import os
  File "C:/virtualenvs/ecst_venv_D111P36A22M51\lib\os.py", line 409
    yield from walk(new_path, topdown, onerror, followlinks)
             ^
SyntaxError: invalid syntax

Can anyone please confirm if there is an alternative to using different apache instances.


It is impossible to do what you are asking due to the way mod_wsgi is loaded in to Apache. Only one version of Python may be referenced by an Apache instance at a time. 

Also, you cannot run multiple instances of Apache on the same server of they are using the same ports (default 80 and 443), and the server only has a single IP address. To run seperate instances, you'll either need a second server with its own IP, or you'll need to add a second IP to your existing server and bind each instance of Apache to a specific IP.

A possible third option is to place a proxy process (such as Nginx or even a third Apache instance) in front of both of your Apache instances on the same server (bound to different ports on the localhost adapter). Depending on the resource requested, that process would proxy the request to the local bindings of Apache for the appropriate Python version.

Two separate servers is the cleanest solution.

-James


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUEkTqSVmBFsDooUTFd_Q6xUhqkh9FbgE8Vw7uoncV_LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment