Add guidance for uwsgi applications

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Unresolved
    • Priority: Major - P3
    • next
    • Affects Version/s: None
    • Component/s: Docs
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Add uwsgi guidance to our documentation, similar to https://pymongo.readthedocs.io/en/stable/examples/mod_wsgi.html

      Apps can, and in fact should, use both --lazy-apps and --enable-threads. --enable-threads is required for PyMongo to work so they must use it. --lazy-apps is not required but does help avoid the app having to deal with the fact that MongoClient is not fork-safe. References:

      Are there any issues with using --py-call-osafterfork with --enable-threads?

      The documentation for --py-call-osafterfork is very sparse (all it says is "enable child processes running cpython to trap OS signals") but from this open uwsgu issue I gather that this flag means that uwsgi will call PyOS_AfterFork_Child() in the forked child process. PyOS_AfterFork_Child() will call the "after_in_child" functions registered via os.register_at_fork. This flag enables uwsgi apps to trigger some cleanup or initialization code in the child process. For example an app could use this flag and os.register_at_fork+after_in_child to reinitialize any global MongoClients.

            Assignee:
            Unassigned
            Reporter:
            Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: