Folks,
I’m mostly done with a web server / web gallery application using Twisted Web.
Now I’ve used a variety of different technologies, including:
pybonjour
scandir
Bootstrap
Jquery
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.
root.putChild("index", IndexPage(ctx))
root.putChild("login", LoginPage(connection))
root.putChild("logout", LogoutPage())
root.putChild("javascript", static.File("javascript",
"application/javascript”))
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?
- Benjamin
_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web