Saturday, December 29, 2018

500 Internal Server Error!! - Issue in wsgi in django application migrating from python2.7 to python3.6

I am getting 500 Internal Server Error when I migrated my django app from python2.7 to python3.6. I have created a new virtualenv, and created all the apps individually. The virtualenv is defined in uwsgi.ini file

home = /home/netadc/.venvs1/netadc

I have installed all the packages using pip3.6. I am not sure what I am missing. Every config in uwsgi is same as python2.7 when it was working.I am using uwsgi 2.0.13. I have restarted nginx as well. Is there a separate uwsgi for python3 which I cannot locate? The socket permissions are also same as before. Please help.

The command to start wsgi is :- /home/netadc/.venvs1/netadc/bin/uwsgi --ini /home/netadc/apps/netadc/netadc/uwsgi/netadc_uwsgi.ini --enable-threads

In wsgi logs, i see :- --- no python application found, check your startup logs for errors --- [pid: 13634|app: -1|req: -1/3] x.x.x.x () {42 vars in 1029 bytes} [Mon Dec 17 09:04:40 2018] GET /netadc/home => generated 21 bytes in 0 msecs (HTTP/1.1 500)

The access logs in nginx show :- x.x.x.x - - [17/Dec/2018:09:05:43 -0700] "GET /netadc/home HTTP/1.1" 500 32

Nothing comes up in nginx error logs.

When I do manage.py shell, I see :- ImportError: bad magic number in 'lib': b'\x03\xf3\r\n'

I removed all the .pyc files, but then sometimes manage.py shell hangs up and sometimes it opens fine. But again after sometime, I will get the magic number error as above.

When I revert the virtualenv back to my previous virtualenv in the uwsgi.ini file which uses python2.7, I get some error logs on uwsgi.

home = /home/netadc/.venvs/netadc Log :- File "./ivpn/rest_appviewx.py", line 29 print('Server IP has NAT already. So no QIP update needed.', end=' ') ^ SyntaxError: invalid syntax

--
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/bb716e96-b7f8-4fec-b51b-713a3edc427e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment