Im a .net developer used to work with asp.net mvc framework and Im trying to introduce myself to the python world, specifically trying to code some websites using django, but Im having a hard time figuring out django's structure.
In asp.net mvc, I use asp.net mvc framework just as a presentation layer, my business logic and my data layer is independant. This is the basic structure of all my asp.net mvc sites:
The website is an asp.net mvc project, while the business logic and the datatypes projects are class libraries (dlls). In the business logic project, I use an entity framework model (with all the classes it generates) and I create some classes that I call "Managers" that contains the core logic of the system. For example if the webiste is for a blog website, the "UsersMgr" would contain the following operations "RegisterUser, GetUser, ConfirmUserAccount" and the "PostsMgr" would contain the operations "AddPost, RemovePost, EditPost, AddComentToPost, etc".
The idea in this approach is that the website is just a presentation layer, which uses the business logic, but its not tightly coupled to it. I usually add an "Admin Console" (another asp.net mvc website for the administrators), "Reports for some partner" (for example imagine that the blog has advertisement and we give the partners a login so they can update their ads and see reports on how many times the ad was shown, etc), a "rest api" so that if I want to create a mobile app I can expose the business logic through a rest API, crons to run maintainance tasks or reports to be sent my email at the end of each day, etc.
On my .net projects with the previous architecture, adding those new things looks like this:
Basically all those new added items are "consumers" of the business logic.
Im having a hard time figuring out how to achieve something like this with django, because the web apps seem really tightly coupled with their models, which are mappings to the db tables. So where should I put the business logic if I want to reuse it later in a non django website?
And about the django apps, I read all over the place that its good to split the website in django apps, but how do you do it when usually the concepts are coupled. For example, a blog might have users, posts, comments, tags, etc. My problem is that everything is linked together, the posts belong to a user, the tags and the comments are linked to a post. What do you do with this relationships?
I would really appreciate if someone could help me with this, I did some python scripts for my raspberry pi and it looks like an awesome language, but Im having a hard time with django. There has to be something that Im missing...
Thanks!