<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">thks for the post - looks like using
      emperor might be the key for flask with nginx - but still, it
      looks like a lot of pieces to put together and we have Bottle
      working fine so it's hard to justify the time to play more with
      Flask server side configs.    From my professor side, I've learned
      that a tutorial post has to be really detailed, with every step by
      step shown, otherwise it requires the user/reader enormous amounts
      of time to play with and figure it all out.  <br>
      <br>
      Actually we are now liking Bottle more than Flask - can't really
      see what we are missing by using Bottle since we are using
      straight psycopg sql calls instead of an ORM and aren't interested
      in using the WTF form stuff.  Only thing we see missing is
      session.  We looked at using pure postgres for session but going
      back to trying beaker + redis which I think is what Flask uses.  
      I think if we wanted more of a framework for a programming group
      we would just move to Django.  <br>
      <br>
      Sad, that the simple, get things done, micro frameworks like
      Bottle and Sinatra seem to get no love.  <br>
      <br>
      Jeff, your post did lead to your blog site which has some pretty
      incredible blogs - some really great stuff there.  <br>
      <br>
      <br>
      On 10/15/2015 02:35 PM, Jeff Widman wrote:<br>
    </div>
    <blockquote
cite="mid:CABPX=-4OF1YEWxEQOTQAcozw7fS5EaLKDFuBfaME3m322pRHtA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Sure, here's a blog post showing my working config
        for Flask + uWSGI Emperor + Nginx:
        <div><br>
        </div>
        <div><a moz-do-not-send="true"
href="http://www.jeffwidman.com/blog/802/serving-multiple-flask-apps-via-uwsgi-nginx/">http://www.jeffwidman.com/blog/802/serving-multiple-flask-apps-via-uwsgi-nginx/</a><br>
        </div>
        <div><br>
        </div>
        <div>Feel free to ask questions or suggest improvements... </div>
        <div hspace="streak-pt-mark" style="max-height:1px"><img
            moz-do-not-send="true"
            style="width:0px;max-height:0px;overflow:hidden"
src="mailbox:///home/front/.icedove/szm52m1h.default/Mail/Local%20Folders/Drafts?number=4519777&sender=aamVmZkBqZWZmd2lkbWFuLmNvbQ%3D%3D&type=zerocontent&guid=d55ba6e8-83ee-4484-88b7-99af534d376e"><font
            color="#ffffff" size="1">ᐧ</font></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Oct 6, 2015 at 4:03 PM,
          tigernassau <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:tigernassau@gmail.com" target="_blank">tigernassau@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>Hmm, looked at pull request - more confusion!   Would
                try emperor but see no docs on that - is your setup
                something you can post?.  Otherwise we have Bottle
                working nicely (and only seems to be missing session vs
                Flask, so it might be easier to just get Beaker working
                with Bottle <br>
                <div>
                  <div class="h5"> <br>
                    On 10/06/2015 03:03 PM, Jeff Widman wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">
                    <div dir="ltr">I just setup Nginx + uWSGI + Flask
                      the other day for the first time. You're right,
                      the Flask docs on uWSGI are outdated and use
                      deprecated uWSGI commands. There's a pull request
                      in the Flask repo that shows the correct way (as
                      best I could tell) to set things up, it also
                      covers the slightly more complicated scenario of
                      serving multiple Flask apps on a single uWSGI
                      socket.
                      <div><br>
                      </div>
                      <div>I take a cursory look through your code and
                        nothing stuck out to me... I used the Emperor
                        option in place of the Master process option, as
                        it gives more flexibility, so maybe that's why
                        I'm not seeing the specific issue... maybe try
                        that? </div>
                      <div hspace="streak-pt-mark"
                        style="max-height:1px"><img
                          moz-do-not-send="true"
                          style="width:0px;max-height:0px;overflow:hidden"><font
                          color="#ffffff" size="1">ᐧ</font></div>
                    </div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On Tue, Oct 6, 2015 at
                        9:03 AM, tigernassau <span dir="ltr"><<a
                            moz-do-not-send="true"
                            href="mailto:tigernassau@gmail.com"
                            target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:tigernassau@gmail.com">tigernassau@gmail.com</a></a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">we can only get Flask
                          to load on a debian server with nginx, uwsgi
                          with a command line statement, not on server
                          boot - yet we can get bottle to load just
                          fine.<br>
                          <br>
                          most of the docs are either outdated, 80%
                          complete, or different combinations (ie
                          gunicorn, mod_wsgi, uwsgi-plugin-python,
                          systemd ...) so we hope to write up a detailed
                          set of docs that work for this combination<br>
                          <br>
                          Here's what we have:<br>
                          nginx.conf<br>
                               .....<br>
                                upstream testapp {<br>
                                    server localhost: 8082;<br>
                                }<br>
                               .....<br>
                               location / {<br>
                                        try_files $uri @wsgi;<br>
                                }<br>
                                location @wsgi {<br>
                                        include /etc/nginx/uwsgi_params;<br>
                                        uwsgi_pass testapp<br>
                                }<br>
                               .....<br>
                          <br>
                          /etc/uwsgi/apps-enabled/testapp.ini<br>
                            [uwsgi]<br>
                            socket = localhost: 8082<br>
                            chdir = /home/testapp<br>
                            file = app.py<br>
                            master = true<br>
                            plugins = python<br>
                            uid = www-data<br>
                            gid = www-data<br>
                            vacuum = true<br>
                          <br>
                          --- test command line run --- (works!)<br>
                          sudo uwsgi --socket <a moz-do-not-send="true"
                            href="http://127.0.0.1:8082"
                            rel="noreferrer" target="_blank">127.0.0.1:8082</a>
                          --wsgi-file /home/testapp/app.py --callable
                          app processes 4 --stats <a
                            moz-do-not-send="true"
                            href="http://127.0.0.1:9191"
                            rel="noreferrer" target="_blank">127.0.0.1:9191</a><br>
                          <br>
                          /etc/systemd/system/testapp.service<br>
                          [Unit]<br>
                          Description=wsgi flask testapp<br>
                          [Service]<br>
                          ExecStart=uwsgi --socket <a
                            moz-do-not-send="true"
                            href="http://127.0.0.1:8082"
                            rel="noreferrer" target="_blank">127.0.0.1:8082</a>
                          --wsgi-file /home/testapp/app.py --callable
                          app --processes 4<br>
                          Restart=always<br>
                          KillSignal=SIGQUIT<br>
                          Type=notify<br>
                          StandardError=syslog<br>
                          NotifyAccess=all<br>
                          <br>
                          [Install]<br>
                          WantedBy=multi-user.target<br>
                          <br>
                          sudo service testapp start ==> error<br>
                          <br>
                          The only difference we see between Flask not
                          booting and Bottle working is in the app run
                          statement<br>
                          Flask:<br>
                          if __name__ == '__main__':<br>
                            app.run()<br>
                          <br>
                          Bottle:<br>
                          if __name__ == '__main__':<br>
                              bottle.run(host="127.0.0.1",port=8082)<br>
                          else:<br>
                              app = application = bottle.default_app()<br>
                          <br>
                          <br>
                          maybe app run issue ??<br>
                          maybe permission issue ?? (but wsgi ini works
                          for bottle)<br>
                          maybe systemd service file ??<br>
                          <br>
                          thks.<span><font color="#888888"><br>
                              <br>
                              -- <br>
                              Tiger Nassau, Inc.<br>
                              <a moz-do-not-send="true"
                                href="http://www.tigernassau.com"
                                rel="noreferrer" target="_blank">www.tigernassau.com</a><br>
                              <br>
_______________________________________________<br>
                              Flask mailing list<br>
                              <a moz-do-not-send="true"
                                href="mailto:Flask@python.org"
                                target="_blank">Flask@python.org</a><br>
                              <a moz-do-not-send="true"
                                href="https://mail.python.org/mailman/listinfo/flask"
                                rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/flask</a><br>
                            </font></span></blockquote>
                      </div>
                      <br>
                      <br clear="all">
                      <div><br>
                      </div>
                      -- <br>
                      <div>
                        <div dir="ltr">
                          <div><b><br>
                              Jeff Widman</b></div>
                          <div><a moz-do-not-send="true"
                              href="http://www.jeffwidman.com/"
                              target="_blank">jeffwidman.com</a> | <a
                              moz-do-not-send="true"
                              value="+15102897784"
                              style="color:rgb(17,85,204)">740-WIDMAN-J
                              (943-6265)</a> </div>
                          <div><><</div>
                        </div>
                      </div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
Flask mailing list
<a moz-do-not-send="true" href="mailto:Flask@python.org" target="_blank">Flask@python.org</a>
<a moz-do-not-send="true" href="https://mail.python.org/mailman/listinfo/flask" target="_blank">https://mail.python.org/mailman/listinfo/flask</a>
</pre>
                  </blockquote>
                  <br>
                  <br>
                </div>
              </div>
              <span class="HOEnZb"><font color="#888888">
                  <pre cols="72">-- 
Tiger Nassau, Inc.
<a moz-do-not-send="true" href="http://www.tigernassau.com" target="_blank">www.tigernassau.com</a></pre>
                </font></span></div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">
          <div dir="ltr">
            <div><b><br>
                Jeff Widman</b></div>
            <div><a moz-do-not-send="true"
                href="http://www.jeffwidman.com/" target="_blank">jeffwidman.com</a> | <a
                moz-do-not-send="true" value="+15102897784"
                style="color:rgb(17,85,204)">740-WIDMAN-J (943-6265)</a> </div>
            <div><><</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Tiger Nassau, Inc.
<a class="moz-txt-link-abbreviated" href="http://www.tigernassau.com">www.tigernassau.com</a></pre>
  </body>
</html>