You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and we can look in that directory, get all the modules and classes, check they are an instance on model and load them into the container with their .__name__
The text was updated successfully, but these errors were encountered:
so what I actually built here was a whole autoloader.
We can do something like this in our application/config.py:
AUTOLOAD= [
'app',
'app/models'
]
and when we first start the server, it will look through both directories, find all the classes in the directory and autoload them into the container and bind the name of the class and the class into the container. So with a structure like:
app/
http/
providers/
models/
Blog.py # contains 2 classes: Blog and Time
Author.py
Post.py
User.py
but it will be done automatically. We'll also be able to load all classes in a single module:
AUTOLOAD= [
'app/User'
]
which will load all the classes in app/User.py. There should only be 1 class in there by convention but some developers may wish to do multiple classes just because of how Python developers are.
we can set a location to look for models in the configuration setting:
and we can look in that directory, get all the modules and classes, check they are an instance on model and load them into the container with their
.__name__
The text was updated successfully, but these errors were encountered: