0

I have built an app on Django 2.0 and deployed to pythonanywhere.com. As Pythonanywhere.com hosting does not have SMTP server, I used external server (used hostiq.com SMPT server, where I have other websites hosted) to send messages using views. Everything worked fine, except the price :)

So I moved the app to reg.ru hosting (because it is cheap and has SMTP server). The web app works fine, except the links that send mails. All the veiws functions that use sending mails, fail and give an error "Incomplete response received from application". You can test it yourself by following the link: http://www.tajadventures.com/contact-us/

More information which may be useful to solve the problem:

1) I have two apps in a shared hosting reg.ru. 2) I use virtual environment on the server; 3) The Customer Support says that using PROXY (like this Working with django : Proxy setup ) is NOT ALLOWED in shared hosting. 4) This is what the log file says (sent by customer support):

open("/opt/openssl/openssl11/cert.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/openssl/openssl11/certs/6a909d98.0", 0x7ffd3f0aebb0) = -1 ENOENT (No such file or directory)
stat("/opt/openssl/openssl11/certs/4a6481c9.0", 0x7ffd3f0aebb0) = -1 ENOENT (No such file or directory)
stat("/opt/openssl/openssl11/certs/4a6481c9.0", 0x7ffd3f0aebb0) = -1 ENOENT (No such file or directory)

When trying to connect using port 465, gives below error:

ioctl(12, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b0240) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(12, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b01c0) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b0870) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b07f0) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b0ea0) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b0e20) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b14d0) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b1450) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b1b00) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b1a80) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b2130) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b20b0) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b2760) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b26e0) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b2d90) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b2d10) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b33c0) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(7, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd3f0b3340) = -1 ENOTTY (Inappropriate ioctl for device)

After what the script ends with this errors:

write(2, "[ pid=446821, time=2019-03-15 05:51:32,197 ]: WSGI application raised an exception!\nTraceback (most recent call last):\n  File \"/opt/python/python-3.7.0/lib/python3.7/urllib/request.py\", line 1317, in do_open\n    encode_chunked=req.has_header('Transfer-encoding'))\n  File \"/opt/python/python-3.7.0/lib/python3.7/http/client.py\", line 1229, in request\n    self._send_request(method, url, body, headers, encode_chunked)\n  File \"/opt/python/python-3.7.0/lib/python3.7/http/client.py\", line 1275, in _send_request\n    self.endheaders(body, encode_chunked=encode_chunked)\n  File \"/opt/python/python-3.7.0/lib/python3.7/http/client.py\", line 1224, in endheaders\n    self._send_output(message_body, encode_chunked=encode_chunked)\n  File \"/opt/python/python-3.7.0/lib/python3.7/http/client.py\", line 1016, in _send_output\n    self.send(msg)\n  File \"/opt/python/python-3.7.0/lib/python3.7/http/client.py\", line 956, in send\n    self.connect()\n  File \"/opt/python/python-3.7.0/lib/python3.7/http/client.py\", line 1392, in connect\n    server_hostname=server_hostname)\n  File \"/opt/python/python-3.7.0/lib/python3.7/ssl.py\", line 412, in wrap_socket\n    session=session\n  File \"/opt/python/python-3.7.0/lib/python3.7/ssl.py\", line 850, in _create\n    self.do_handshake()\n  File \"/opt/python/python-3.7.0/lib/python3.7/ssl.py\", line 1108, in do_handshake\n    self._sslobj.do_handshake()\nssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/var/www/u0673882/data/taj/lib/python3.7/site-packages/django/core/handlers/exception.py\", line 35, in inner\n    response = get_response(request)\n  File \"/var/www/u0673882/data/taj/lib/python3.7/site-packages/django/core/handlers/base.py\", line 128, in _get_response\n    response = self.process_exception_by_middleware(e, request)\n  File \"/var/www/u0673882/data/taj/lib/python3.7/site-packages/django/core/handlers/base"..., 13113) = 13113
write(2, "\n", 1)                       = 1
shutdown(11, SHUT_WR)                   = 0

5) The app works fine in another server and local machine.

6) logs

[Wed Mar 13 19:23:39 2019] [error] [client 217.11.191.130] File does not exist: /var/www/u0673882/data/www/tajadventures.com/b-dropdown.78b8a4cc60332c97c45cdca66a52b299.png, referer: http://www.tajadventures.com/hosting_static_parking.css
[Wed Mar 13 19:25:27 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 19:32:39 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:11:45 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:12:27 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:12:28 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:14:33 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:18:00 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:22:35 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:22:45 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:25:39 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:25:42 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:26:27 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:26:29 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:28:00 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:28:03 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:28:07 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:28:08 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:28:08 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:28:09 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:29:30 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:29:33 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:30:24 2019] [error] [client 217.11.191.130] File does not exist: /var/www/u0673882/data/www/tajadventures.com/b-dropdown.78b8a4cc60332c97c45cdca66a52b299.png, referer: http://www.tajadventures.com/hosting_static_parking.css
[Wed Mar 13 20:30:57 2019] [error] [client 217.11.191.130] File does not exist: /var/www/u0673882/data/www/tajadventures.com/b-dropdown.78b8a4cc60332c97c45cdca66a52b299.png, referer: http://www.tajadventures.com/hosting_static_parking.css
[Wed Mar 13 20:31:20 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
[Wed Mar 13 20:34:40 2019] [error] [client 217.11.191.130] Directory index forbidden by Options directive: /var/www/u0673882/data/www/tajadventures.com/
2019/03/13 23:24:31 [warn] 376904#0: *12310753 upstream server temporarily disabled while reading response header from upstream, client: 54.165.59.7, server: tajadventures.com, request: "GET /blog/1/we-have-released-our-website/ HTTP/1.0", upstream: "http://127.0.0.1:8080/blog/1/we-have-released-our-website/", host: "www.tajadventures.com"
2019/03/13 23:24:35 [warn] 376901#0: *12310776 upstream server temporarily disabled while reading response header from upstream, client: 54.165.59.7, server: tajadventures.com, request: "GET /cars/1/toyota/ HTTP/1.0", upstream: "http://127.0.0.1:8080/cars/1/toyota/", host: "www.tajadventures.com"
2019/03/14 02:31:31 [warn] 90382#0: *12372200 upstream server temporarily disabled while reading response header from upstream, client: 66.249.70.11, server: tajadventures.com, request: "GET /tours/2/dushanbe-city-tour/ HTTP/1.1", upstream: "http://127.0.0.1:8080/tours/2/dushanbe-city-tour/", host: "www.tajadventures.com"
2019/03/14 02:38:43 [warn] 90383#0: *12378817 upstream server temporarily disabled while reading response header from upstream, client: 66.249.70.5, server: tajadventures.com, request: "GET /tours/3/trekking-to-the-lake-sarez/ HTTP/1.1", upstream: "http://127.0.0.1:8080/tours/3/trekking-to-the-lake-sarez/", host: "www.tajadventures.com"
[Thu Mar 14 16:59:31 2019] [error] [client 79.170.191.3] ModSecurity: Warning. Matched phrase "m.js" at RESPONSE_BODY. [file "/etc/httpd/mod_security/trustwave_rules.conf"] [line "2977"] [id "2500005"] [rev "11272018"] [msg "SLR: Bomonero - Crypto-Mining Activity"] [severity "CRITICAL"] [tag "attack-crypto mining"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "https://www.trustwave.com/Resources/Trustwave-Blog/All-the-Ways-Cybercriminals-Are-Exploiting-the-Cryptocurrency-Boom/"] [hostname "www.tajadventures.com"] [uri "/admin/tours/tour/add/"] [unique_id "XIpeQx8fxgQABOQbpd8AAAEQ"]

Is there any way to fix this bug? Thanks is advance for your time.

Saidmamad
  • 63
  • 1
  • 13
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/190269/discussion-on-question-by-saeed-django-incomplete-response-received-from-applica). – Samuel Liew Mar 19 '19 at 00:18

1 Answers1

0

So, the solution to the problem in my case was to remove Google's ReCaptcha, from my view function. My current settings look like below:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = False
EMAIL_HOST = 'server229.hosting.reg.ru'
EMAIL_PORT = 587
EMAIL_HOST_USER =  'info@domain.com'
EMAIL_HOST_PASSWORD = '********'

But I think this error has many reasons, for example accessing the url which does not exist, and etc.

Saidmamad
  • 63
  • 1
  • 13