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

running moinmoin 1.9.x with PyPy #91

Open
ThomasWaldmann opened this issue Jun 19, 2022 · 1 comment
Open

running moinmoin 1.9.x with PyPy #91

ThomasWaldmann opened this issue Jun 19, 2022 · 1 comment

Comments

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Jun 19, 2022

CPython 2.7 is out of support since quite a while and because of that often removed from new distributions.

But there is pypy (not: pypy3) and you can use it to run moin!

https://www.pypy.org/

ubuntu 22.04:

apt install pypy pypy-dev pypy-setuptools
apt install virtualenv
virtualenv --python=pypy env-pypy
source env-pypy/bin/activate

Now you have a virtual env active with a python 2.7 compatible pypy.

Running moin:

cd moin-1.9
python wikiserver.py

moin will then run on localhost:8080 (this can be changed in wikiserverconfig.py).

@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Jun 19, 2022

Wasn't successful yet installing uwsgi, but gunicorn seems to work:

#!/usr/bin/env pypy

import multiprocessing

import gunicorn.app.base

from MoinMoin.wsgiapp import application as handler_app


class StandaloneApplication(gunicorn.app.base.BaseApplication):

    def __init__(self, app, options=None):
        self.options = options or {}
        self.application = app
        super(StandaloneApplication, self).__init__()

    def load_config(self):
        config = {key: value for key, value in self.options.items()
                  if key in self.cfg.settings and value is not None}
        for key, value in config.items():
            self.cfg.set(key.lower(), value)

    def load(self):
        return self.application


if __name__ == '__main__':
    options = {
        'bind': '%s:%s' % ('0.0.0.0', '8080'),
        'workers': multiprocessing.cpu_count() * 2 + 1,
    }
    StandaloneApplication(handler_app, options).run()

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

No branches or pull requests

1 participant