Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pypiserver v1.1.10 and gunicorn don't work #112

Closed
montefra opened this issue Feb 15, 2016 · 8 comments
Closed

pypiserver v1.1.10 and gunicorn don't work #112

montefra opened this issue Feb 15, 2016 · 8 comments
Assignees
Labels
Milestone

Comments

@montefra
Copy link

On version 1.1.09 and 1.1.10 calling:

gunicorn -w4 'pypiserver:app("/home/ralf/packages")'

gives

Traceback (most recent call last):
  File "/home/pypi/.virtualenvs/pypiserver/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
    worker.init_process()
  File "/home/pypi/.virtualenvs/pypiserver/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
    self.load_wsgi()
  File "/home/pypi/.virtualenvs/pypiserver/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/home/pypi/.virtualenvs/pypiserver/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/home/pypi/.virtualenvs/pypiserver/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/home/pypi/.virtualenvs/pypiserver/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/home/pypi/.virtualenvs/pypiserver/lib/python2.7/site-packages/gunicorn/util.py", line 368, in import_app
    app = eval(obj, mod.__dict__)
  File "<string>", line 1, in <module>
TypeError: app() takes exactly 0 arguments (1 given)

1.1.8 and before seem to work.

Is this a bug or you forgot to update the documentation?

@ankostis ankostis self-assigned this Feb 15, 2016
@ankostis ankostis added this to the Next 1.2.x Release milestone Feb 15, 2016
@ankostis
Copy link
Member

A bug.

@montefra
Copy link
Author

I'll run 1.1.8 for now then.

Thank you for the server.

@virtuald
Copy link
Contributor

virtuald commented Mar 4, 2016

This is actually a documentation bug (though, for backwards compatibility it should probably be addressed). You can run it using this:

gunicorn -w4 'pypiserver:app(root="/home/ralf/packages")'

@montefra
Copy link
Author

montefra commented Mar 4, 2016

Ok. I'll give a try as soon as I can. Thank you for the info.

virtuald added a commit to virtuald/pypiserver that referenced this issue Mar 4, 2016
@ankostis
Copy link
Member

@montefra are you ok with @corywright 's solution in #118?
I think keyworded-arguments fit better to cmd-line tools than positional ones.
So I vote to break backward-compatibility (well, typically, _api is an internal API, but...leaky abstraction).

@montefra
Copy link
Author

@ankostis: with me it's fine and the change make sense
However I don't think that this is really an internal API, since is in the documentation and it's the way to make the server run with gunicorn/apache/others. Wouldn't be more sensible to have a transition api for a few releases? Something along the line:

def api(*args, **kwarg):
    if len(args) == 1 and 'root' not in kwargs:
         warnings.warn(DeprecationWarning, "the positional arguments are deprecated, please use the keywork argument ``root``")
    elif len(args) == 1:
         raise SomeError("it isn't possible to use the position argument and the ``root`` keyword at the same time")
    elif len(args) > 1: 
        raise SomeError("only one positional argument is allowed")
    # continue as in the new version

I completely forgot to test the code with root=, but I guess it will work.

ps: we ended up using apache, as we couldn't make gunicorn work with proxy and reverse proxy

@ankostis
Copy link
Member

I agree about _api not being private - that decision predates me.
The whole startup procedure needs further rework.

For your suggestion, it is too exceptional code for something that a simple solution works.
Thank you for your attitude of respect to the users of this project, beyond the bug-report, of course.

@montefra
Copy link
Author

👍 Thank you for the software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants