Graham Dumpleton! My best complements, regards, blessing and other stuff!!!
That worked, i'll be testing this solution for now.

and again, thanks a lot!

среда, 17 августа 2016 г., 16:54:05 UTC+6 пользователь Graham Dumpleton 
написал:
>
> The process is crashing, likely because of a fault C extension module. Try 
> adding:
>
>     WSGIApplicationGroup %{GLOBAL}
>
> See:
>
>     
> http://modwsgi.readthedocs.io/en/develop/user-guides/application-issues.html#python-simplified-gil-state-api
>
> Graham
>
> On 17 Aug 2016, at 8:36 PM, Anatoly Piskunov <[email protected] 
> <javascript:>> wrote:
>
> Hello Graham Dumpelton, and rest of the fellow community! 
> i need your competent help with this issue. I've read almost all of the 
> threads, but unfortunately didn't get a solution. 
>
> System details:
> *5.5.46-0ubuntu0.14.04.2 - (Ubuntu)*
>
> *user01@vkc-sandbox02:/var/log/apache2$ uname -a*
> *Linux vkc-sandbox02 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 
> UTC 2015 x86_64 x86_64 x86_64 GNU/Linux*
>
> *Apache/2.4.7 (Ubuntu)*
>
> *Python 3.4.3 (virtual env)*
> *Python 3.4.3 (system)*
> *Python 2.7 (system)*
>
> *mod-wsgi (4.5.4)*
> *Django 1.10*
>
> *user01@vkc-sandbox02:/etc/apache2/mods-enabled$ cat wsgi.conf*
> <IfModule mod_wsgi.c>
> #it's empty
> </IfModule>
>
> *user01@vkc-sandbox02:/etc/apache2/mods-enabled$ cat wsgi.load*
> LoadModule wsgi_module /usr/lib/apache2/modules/
> mod_wsgi-py34.cpython-34m.so
>
> user01@vkc-sandbox02:/etc/apache2/sites-enabled$ cat 000-default.conf
>
> <VirtualHost *:80>
>         WSGIDaemonProcess fb_bot 
> python-path=/home/user01/nano_fb_py_bot:/home/user01/.virtualenvs/dev_fbbot_ve/bin:/home/user01/.virtualenvs/dev_fbbot_ve/lib/python3.4/site-packages
>  
> header-buffer-size=32768
>         WSGIProcessGroup fb_bot
>         WSGIScriptAlias / 
> /home/user01/nano_fb_py_bot/nano_fb_py_bot/wsgi.py
>         <Directory /home/user01/nano_fb_py_bot/nano_fb_py_bot>
>         <Files wsgi.py>
>         Require all granted
>         </Files>
>         </Directory>
>         ServerAdmin webmaster@localhost
>         DocumentRoot /var/www/html
>         LogLevel info wsgi:debug
>         ErrorLog ${APACHE_LOG_DIR}/django-error.log
>         CustomLog ${APACHE_LOG_DIR}/access.log combined
>         Header set Access-Control-Allow-Origin "*"
> </VirtualHost>
>
>
> *wsgi.py*
> import os, sys
>
> from django.core.wsgi import get_wsgi_application
> import django.core.handlers.wsgi
> import sys
> sys.stdout = sys.stderr
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nano_fb_py_bot.settings")
> application = get_wsgi_application()
>
>
>
> and finally, *views.py *
> user01@vkc-sandbox02:~/nano_fb_py_bot/fb_nanosemantics$ cat views.py
> from django.shortcuts import render
> from django.views import generic
> from django.http.response import HttpResponse
> from django.views.decorators.csrf import csrf_exempt
> from django.utils.decorators import method_decorator
> import traceback
> import pymysql.cursors
> import json, requests, re
> import hashlib
> from multiprocessing import Pool
> PAGE_ACCESS_TOKEN = 'some_token'
> VERIFY_TOKEN = '123456789'
>
>
> # Create your views here.
> class FacebookBotView(generic.View):
>     def get(self, request, *args, **kwargs):
>      if self.request.GET['hub.verify_token'] == VERIFY_TOKEN:
>       return HttpResponse(self.request.GET['hub.challenge'])
>      else:
>       return HttpResponse('Error, invalid token')
>
>     @method_decorator(csrf_exempt)
>     def dispatch(self, request, *args, **kwargs):
>      return generic.View.dispatch(self, request, *args, **kwargs)
>
> When i run Django app from development web server, 
> python manage.py runserver 127.0.0.1:8000
> everything works like a charm when i do *curl 
> 127.0.0.1:8000/Path_to_View/LInk?hub.verify_token=some_token&hub.challenge=some_challenge
>  
> <http://127.0.0.1:8000/Path_to_View/LInk?hub.verify_token=some_token&hub.challenge=some_challenge>*
> when i don't pass get params, i see error (and that's great!!!)
>
> But when i try access this url served by apache - i get internal server 
> error 500.
> And no error traceback shown in my virtualhost apache logs (please see 
> below).
>
> if i simplify views.py, as below 
> class FacebookBotView(generic.View):
>     def get(self, request, *args, **kwargs):
>      return HttpResponse('Hello World!')
>
>     @method_decorator(csrf_exempt)
>     def dispatch(self, request, *args, **kwargs):
>      return generic.View.dispatch(self, request, *args, **kwargs)
> Page accessible via apache, and i get web response.
> but if i make a syntax, or ident mistake, or call some function - the 
> error comes back again, with no traceback.
>
> And i mention again - none of this appears with dev. web server.
>
>
> [Wed Aug 17 16:06:49.735396 2016] [wsgi:info] [pid 4122] mod_wsgi 
> (pid=4122): Create interpreter 'vkc-sandbox02.kcell.kz|'.
> [Wed Aug 17 16:06:49.765976 2016] [wsgi:info] [pid 4122] mod_wsgi 
> (pid=4122): Adding '/home/user01/nano_fb_py_bot' to path.
> [Wed Aug 17 16:06:49.766645 2016] [wsgi:info] [pid 4122] mod_wsgi 
> (pid=4122): Adding '/home/user01/.virtualenvs/dev_fbbot_ve/bin' to path.
> [Wed Aug 17 16:06:49.767402 2016] [wsgi:info] [pid 4122] mod_wsgi 
> (pid=4122): Adding 
> '/home/user01/.virtualenvs/dev_fbbot_ve/lib/python3.4/site-packages' to 
> path.
> [Wed Aug 17 16:06:49.789132 2016] [wsgi:info] [pid 4122] [remote 
> 10.10.165.20:57995] mod_wsgi (pid=4122, process='fb_bot', application='
> vkc-sandbox02.kcell.kz|'): Loading WSGI script 
> '/home/user01/nano_fb_py_bot/nano_fb_py_bot/wsgi.py'.
> *[Wed Aug 17 16:06:50.946329 2016] [wsgi:error] [pid 4010] [client 
> 10.10.165.20:57995 <http://10.10.165.20:57995>] Truncated or oversized 
> response headers received from daemon process 'fb_bot': 
> /home/user01/nano_fb_py_bot/nano_fb_py_bot/wsgi.py, referer: 
> http://192.168.216.172/fb_nanosemantics/bot 
> <http://192.168.216.172/fb_nanosemantics/bot>*
> [Wed Aug 17 16:06:51.654933 2016] [wsgi:info] [pid 4152] mod_wsgi 
> (pid=4152): Attach interpreter ''.
> [Wed Aug 17 16:06:51.655496 2016] [wsgi:info] [pid 4152] mod_wsgi 
> (pid=4152): Adding '/home/user01/nano_fb_py_bot' to path.
> [Wed Aug 17 16:06:51.656096 2016] [wsgi:info] [pid 4152] mod_wsgi 
> (pid=4152): Adding '/home/user01/.virtualenvs/dev_fbbot_ve/bin' to path.
> [Wed Aug 17 16:06:51.656909 2016] [wsgi:info] [pid 4152] mod_wsgi 
> (pid=4152): Adding 
> '/home/user01/.virtualenvs/dev_fbbot_ve/lib/python3.4/site-packages' to 
> path.
> [Wed Aug 17 16:06:51.693079 2016] [wsgi:info] [pid 4152] mod_wsgi 
> (pid=4152): Imported 'mod_wsgi'.
> [Wed Aug 17 16:06:51.694273 2016] [wsgi:debug] [pid 4152] 
> src/server/mod_wsgi.c(8706): mod_wsgi (pid=4152): Started thread 1 in 
> daemon process 'fb_bot'.
> [Wed Aug 17 16:06:51.694314 2016] [wsgi:debug] [pid 4152] 
> src/server/mod_wsgi.c(8706): mod_wsgi (pid=4152): Started thread 2 in 
> daemon process 'fb_bot'.
> [Wed Aug 17 16:06:51.694263 2016] [wsgi:debug] [pid 4152] 
> src/server/mod_wsgi.c(8706): mod_wsgi (pid=4152): Started thread 0 in 
> daemon process 'fb_bot'.
>
> -- 
> 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.

Reply via email to