NLTK+TextBlob in flask/nginx/gunicorn on Ubuntu 500 error -


i trying run noun phrase analysis in flask app running on ubuntu, served through gunicorn , nginx. getting error 500 no (apparent) logging of error occurring either in nginx, supervisor, or unicorn error logs. nor 'supervisorctl tail app' shed light.

my sites-available nginx.conf:

server {     listen 80;     server_name [domain redacted];     charset utf-8;     client_max_body_size 75m;      access_log /var/log/nginx/nginx_access.log;     error_log /var/log/nginx/nginx_error.log;      location / { try_files $uri @app; }      location @app {         proxy_pass http://127.0.0.1:8000;         proxy_set_header host $host;         proxy_set_header x-real-ip $remote_addr;     } } 

my supervisor app.conf

[program:app] command = gunicorn app:app -b localhost:8000 directory = /home/www/app user = admin 

i running app in app.py following (issue experienced debug = false , true in config.py)

app = flask(__name__, static_folder='static', static_url_path='/static') app.config.from_pyfile('config.py')  if __name__ == '__main__':         app.run()         if not app.debug:             stream_handler = logging.streamhandler()             stream_handler.setlevel(logging.info)             app.logger.addhandler(stream_handler) 

config.py simply

debug = false allowed_hosts=['*'] 

the noun phrases function calling

from textblob import textblob  def generatenounphrases(input):     blob = textblob(input)     np = blob.noun_phrases      return np 

the app.py flask route page, passing output of generatenounphrases()

@app.route('/thread', methods=['get']) def thread():     ...     nounphrases = generatenounphrases(text_to_analyze)        ...      return render_template("thread.html", nounphrases=nounphrases) 

i absolutely lost , absolute novice @ this. guidance tremendous!

the sudo user = admin declared in app.conf supervisor file, created run app, not able read @ site root level. inaccessible nltk corpora downloaded @ /root/nltk_data causing original 500...

i discovered problem after having re-configured gunicorn logging, , receiving fatal supervisor crashes on supervisorctl restart app newly pointed gunicorn.log not having permissions write.

my updated , working supervisor config, sans user declaration, follows:

[program:app] command = gunicorn app:app -b localhost:8000 --log-file /var/log/gunicorn/gunicorn_log.log directory = /home/www/app stdout_logfile=/var/log/supervisor/supervisor_stdout.log stderr_logfile=/var/log/supervisor/supervisor_stderr.log 

i not sure full security implications configuration, however, , not sure why sudo group admin user not accessing directories correctly. bonus points answer.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -