uwsgi with flask-script Manager











up vote
0
down vote

favorite












I use docker-compose to tie every image for launch once.




  • nginx

  • python


In python, I used uwsgi to deploy flask web server.



[manage.py]



import unittest

from app.main import create_app, db
from app.main.model import user
from flask_script import Manager
from app import blueprint

app = create_app(os.getenv('BOILERPLATE_ENV') or 'dev')
app.register_blueprint(blueprint)

app.app_context().push()

manager = Manager(app)

@manager.command
def run():
app.run(host='0.0.0.0')

@manager.command
def test():
"""Runs the unit tests."""
tests = unittest.TestLoader().discover('app/test', pattern='test*.py')
result = unittest.TextTestRunner(verbosity=2).run(tests)
if result.wasSuccessful():
return 0
return 1

if __name__ == '__main__':
manager.run()


As you know, I use flask-script Manager.



So when I execute flaks server, command like this -> python3 manage.py run



[uwsgi.ini]



[uwsgi]
chdir = /home
http-socket = :5001
chmod-socket = 777
logto = /home/web.log
process = 2
wsgi-file = manage.py
callable = manager
daemonize = /home/uwsgi.log
lazy-apps = true
pyargv = run


I set wsgi-file = manage.py and callable = manager.



Also set pyargv = run to same effect with python3 manage.py run



But when I run server and access the web, it throws error.



TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given



Full log here.



root@web_project_dev:/home# uwsgi --ini config/uwsgi.ini
[uWSGI] getting INI configuration from config/uwsgi.ini
root@web_project_dev:/home# tail -f uwsgi.log
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72920 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 65, cores: 1)
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55588beca210 pid: 65 (default app)
TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given
[pid: 65|app: 0|req: 1/1] 192.168.192.4 () {40 vars in 746 bytes} [Tue Nov 13 05:20:44 2018] GET / => generated 0 bytes in 0 msecs (HTTP/1.0 500) 0 headers in 0 bytes (0 switches on core 0)


How can I insert command line parameter to uwsgi.ini?



Thanks.










share|improve this question


























    up vote
    0
    down vote

    favorite












    I use docker-compose to tie every image for launch once.




    • nginx

    • python


    In python, I used uwsgi to deploy flask web server.



    [manage.py]



    import unittest

    from app.main import create_app, db
    from app.main.model import user
    from flask_script import Manager
    from app import blueprint

    app = create_app(os.getenv('BOILERPLATE_ENV') or 'dev')
    app.register_blueprint(blueprint)

    app.app_context().push()

    manager = Manager(app)

    @manager.command
    def run():
    app.run(host='0.0.0.0')

    @manager.command
    def test():
    """Runs the unit tests."""
    tests = unittest.TestLoader().discover('app/test', pattern='test*.py')
    result = unittest.TextTestRunner(verbosity=2).run(tests)
    if result.wasSuccessful():
    return 0
    return 1

    if __name__ == '__main__':
    manager.run()


    As you know, I use flask-script Manager.



    So when I execute flaks server, command like this -> python3 manage.py run



    [uwsgi.ini]



    [uwsgi]
    chdir = /home
    http-socket = :5001
    chmod-socket = 777
    logto = /home/web.log
    process = 2
    wsgi-file = manage.py
    callable = manager
    daemonize = /home/uwsgi.log
    lazy-apps = true
    pyargv = run


    I set wsgi-file = manage.py and callable = manager.



    Also set pyargv = run to same effect with python3 manage.py run



    But when I run server and access the web, it throws error.



    TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given



    Full log here.



    root@web_project_dev:/home# uwsgi --ini config/uwsgi.ini
    [uWSGI] getting INI configuration from config/uwsgi.ini
    root@web_project_dev:/home# tail -f uwsgi.log
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
    your server socket listen backlog is limited to 100 connections
    your mercy for graceful operations on workers is 60 seconds
    mapped 72920 bytes (71 KB) for 1 cores
    *** Operational MODE: single process ***
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
    *** uWSGI is running in multiple interpreter mode ***
    spawned uWSGI worker 1 (and the only) (pid: 65, cores: 1)
    WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55588beca210 pid: 65 (default app)
    TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given
    [pid: 65|app: 0|req: 1/1] 192.168.192.4 () {40 vars in 746 bytes} [Tue Nov 13 05:20:44 2018] GET / => generated 0 bytes in 0 msecs (HTTP/1.0 500) 0 headers in 0 bytes (0 switches on core 0)


    How can I insert command line parameter to uwsgi.ini?



    Thanks.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I use docker-compose to tie every image for launch once.




      • nginx

      • python


      In python, I used uwsgi to deploy flask web server.



      [manage.py]



      import unittest

      from app.main import create_app, db
      from app.main.model import user
      from flask_script import Manager
      from app import blueprint

      app = create_app(os.getenv('BOILERPLATE_ENV') or 'dev')
      app.register_blueprint(blueprint)

      app.app_context().push()

      manager = Manager(app)

      @manager.command
      def run():
      app.run(host='0.0.0.0')

      @manager.command
      def test():
      """Runs the unit tests."""
      tests = unittest.TestLoader().discover('app/test', pattern='test*.py')
      result = unittest.TextTestRunner(verbosity=2).run(tests)
      if result.wasSuccessful():
      return 0
      return 1

      if __name__ == '__main__':
      manager.run()


      As you know, I use flask-script Manager.



      So when I execute flaks server, command like this -> python3 manage.py run



      [uwsgi.ini]



      [uwsgi]
      chdir = /home
      http-socket = :5001
      chmod-socket = 777
      logto = /home/web.log
      process = 2
      wsgi-file = manage.py
      callable = manager
      daemonize = /home/uwsgi.log
      lazy-apps = true
      pyargv = run


      I set wsgi-file = manage.py and callable = manager.



      Also set pyargv = run to same effect with python3 manage.py run



      But when I run server and access the web, it throws error.



      TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given



      Full log here.



      root@web_project_dev:/home# uwsgi --ini config/uwsgi.ini
      [uWSGI] getting INI configuration from config/uwsgi.ini
      root@web_project_dev:/home# tail -f uwsgi.log
      *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
      your server socket listen backlog is limited to 100 connections
      your mercy for graceful operations on workers is 60 seconds
      mapped 72920 bytes (71 KB) for 1 cores
      *** Operational MODE: single process ***
      uWSGI running as root, you can use --uid/--gid/--chroot options
      *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
      *** uWSGI is running in multiple interpreter mode ***
      spawned uWSGI worker 1 (and the only) (pid: 65, cores: 1)
      WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55588beca210 pid: 65 (default app)
      TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given
      [pid: 65|app: 0|req: 1/1] 192.168.192.4 () {40 vars in 746 bytes} [Tue Nov 13 05:20:44 2018] GET / => generated 0 bytes in 0 msecs (HTTP/1.0 500) 0 headers in 0 bytes (0 switches on core 0)


      How can I insert command line parameter to uwsgi.ini?



      Thanks.










      share|improve this question













      I use docker-compose to tie every image for launch once.




      • nginx

      • python


      In python, I used uwsgi to deploy flask web server.



      [manage.py]



      import unittest

      from app.main import create_app, db
      from app.main.model import user
      from flask_script import Manager
      from app import blueprint

      app = create_app(os.getenv('BOILERPLATE_ENV') or 'dev')
      app.register_blueprint(blueprint)

      app.app_context().push()

      manager = Manager(app)

      @manager.command
      def run():
      app.run(host='0.0.0.0')

      @manager.command
      def test():
      """Runs the unit tests."""
      tests = unittest.TestLoader().discover('app/test', pattern='test*.py')
      result = unittest.TextTestRunner(verbosity=2).run(tests)
      if result.wasSuccessful():
      return 0
      return 1

      if __name__ == '__main__':
      manager.run()


      As you know, I use flask-script Manager.



      So when I execute flaks server, command like this -> python3 manage.py run



      [uwsgi.ini]



      [uwsgi]
      chdir = /home
      http-socket = :5001
      chmod-socket = 777
      logto = /home/web.log
      process = 2
      wsgi-file = manage.py
      callable = manager
      daemonize = /home/uwsgi.log
      lazy-apps = true
      pyargv = run


      I set wsgi-file = manage.py and callable = manager.



      Also set pyargv = run to same effect with python3 manage.py run



      But when I run server and access the web, it throws error.



      TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given



      Full log here.



      root@web_project_dev:/home# uwsgi --ini config/uwsgi.ini
      [uWSGI] getting INI configuration from config/uwsgi.ini
      root@web_project_dev:/home# tail -f uwsgi.log
      *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
      your server socket listen backlog is limited to 100 connections
      your mercy for graceful operations on workers is 60 seconds
      mapped 72920 bytes (71 KB) for 1 cores
      *** Operational MODE: single process ***
      uWSGI running as root, you can use --uid/--gid/--chroot options
      *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
      *** uWSGI is running in multiple interpreter mode ***
      spawned uWSGI worker 1 (and the only) (pid: 65, cores: 1)
      WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55588beca210 pid: 65 (default app)
      TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given
      [pid: 65|app: 0|req: 1/1] 192.168.192.4 () {40 vars in 746 bytes} [Tue Nov 13 05:20:44 2018] GET / => generated 0 bytes in 0 msecs (HTTP/1.0 500) 0 headers in 0 bytes (0 switches on core 0)


      How can I insert command line parameter to uwsgi.ini?



      Thanks.







      python uwsgi flask-script






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 at 5:22









      Hide

      322111




      322111





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274309%2fuwsgi-with-flask-script-manager%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274309%2fuwsgi-with-flask-script-manager%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents