I’m mostly done with a web server / web gallery application using Twisted Web.
Now I’ve used a variety of different technologies, including:
But I’m having a little bit of a problem cleaning this up for uploading to github.
Can anyone give me some better suggestions for resources being shared between different web resource classes?
For example, I am using jinja2 and I have to make it a global to be available to all three web resources classes.
I haven’t been able to come up with a better solution?
A working code example is available from https://github.com/sheffler/login_logic_jinja2 <https://github.com/sheffler/login_logic_jinja2>. It’s not my code, but the basic code layout is nigh identical. I used it as a working model for the user authentication and built my gallery code as an additional child resource.
Worded another way, what’s the best practice for sharing data, code, and logic between children in a twisted web application, without making them global?
If global is the best answer, then I’ll continue with that. But it just seems like there should be another way?
I'm happy to announce the first prerelease for Twisted 15.1! This is not a big release, but does have some nice-to-haves:
- You can now install Twisted's optional dependencies (when it's released to PyPI) easier -- for example, `pip install twisted[tls]` installs Twisted with TLS support.
- twisted.web.static.File allows defining a custom resource for rendering forbidden pages.
- Twisted's MSN support is now deprecated.
- More documentation on how Trial finds tests.
As usual, tarballs can be found at http://twistedmatrix.com/Releases/pre/15.1.0pre1/ , and the full NEWS file can be found at http://twistedmatrix.com/Releases/pre/15.1.0pre1/NEWS.txt .
Please test them out! :)