I am creating a web application with Twisted, and for the resources of the site I have this structure:
/resources
__init__.py
file.py
javascript.py
images.py
wsdl.py
/pages
__init__.py
page.py
static.py
login.py
...etc...
where file.pythey page.pycontain parent classes with common functionality (for example, checking files and sessions / templates). Each other script contains one class, which is one twisted resource. My files __init__.pyare as follows:
import javascript
Javascript = javascript.Javascript
import images
Images = images.Images
...
so in the main script, before passing the execution to twisted, I can just import resources; import pages, and then just a link resources.Javascript(), pages.Login()etc. instead of writing
from resources.javascript import Javascript
from resources.images import Images
from resources.wsdl import WSDL
from pages.static import Static
from pages.login import Login
...
and then use each of these classes to create the site structure. It quickly becomes unmanageable.
, " , ".
, ? from pages import *, pages.Static(), pages.Login() ..
, , , , ?