Origami icon indicating copy to clipboard operation
Origami copied to clipboard

[Backend, Discussion]: Django channel support and Dockerfile deprecation.

Open fristonio opened this issue 6 years ago • 8 comments

The Dockerfile we are using does not work anymore, the reason being we are using python2.7 base image and using Django channels which is only supported by python 3.5 and above.

image

Docker builds thus fails in the current state, I haven't looked at any solution as of now. But one obvious solution here is upgrading python to 3.5 or above. And as far as I know the code is Python 3 compatible so there won't be any problem in migration.

@uttu357 @AvaisP any comments?

fristonio avatar Mar 08 '18 23:03 fristonio

@AvaisP Can you look into this?

gupta-utkarsh avatar Mar 09 '18 11:03 gupta-utkarsh

What error does it throw @fristonio ?

AvaisP avatar Mar 09 '18 14:03 AvaisP

While building the docker image using docker-compose build it throws the error

image

while installing channels using pip. I tried installing pathlib beforehand but it does no good installing async-timeout which is a dependency of channels. async-timeout is only python 3 compatible.

image

@AvaisP

fristonio avatar Mar 09 '18 15:03 fristonio

Install pathlib using a separate pip instruction before the uwsgi and channels installation. Try RUN pip install pathlib RUN pip install uwsgi channels

AvaisP avatar Mar 10 '18 23:03 AvaisP

@fristonio Does this solves the issue?

gupta-utkarsh avatar Mar 22 '18 12:03 gupta-utkarsh

Sorry, I don't know how I missed the comment from AvaisP. When I tried adding RUN pip install pathlib as above after clearing the docker containers the install was successful. But there was some problem with django being able to communicate with postgres server. I have to figure it out now, will try to send the pull request as soon as I get it fixed. :)

Thanks for reminding me of this @uttu357

fristonio avatar Mar 22 '18 13:03 fristonio

After building the image using docker-compose build when I try to run a container I get the error

django_app_1  |     connection = Database.connect(**conn_params)                                                      
django_app_1  |   File "/usr/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect            
django_app_1  |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)                            
django_app_1  | django.db.utils.OperationalError: could not connect to server: Connection refused                     
django_app_1  |         Is the server running on host "localhost" (127.0.0.1) and accepting                           
django_app_1  |         TCP/IP connections on port 5432?                                                              
django_app_1  | could not connect to server: Cannot assign requested address                                          
django_app_1  |         Is the server running on host "localhost" (::1) and accepting                                 
django_app_1  |         TCP/IP connections on port 5432?

Is there some problem with docker-compose too or am I doing something wrong. As I have seen that when I run the container it opens all the ports required 5432 6379 and 8000 but still I get the above error.

@uttu357 @AvaisP

fristonio avatar Apr 02 '18 01:04 fristonio

@fristonio is it still an issue?

vpn1997 avatar Nov 01 '18 11:11 vpn1997