Re: How to lay out large, *modular* website in Django.

2009-11-18 Thread zimnyx
Thank you for replies :-)

I forgot to mention important thing:
Those website modules will probably be run on separate hosts (they can
be put on different hosts or virtual hosts, but still use the same
database)
.. so one point in "What is common between them": "global
configuration (database uri, debug level, i18n, session etc.)" may be
misleading.

My current code layout is:
|-- my_django_projects
|-- foo_common
`-- foo_employees
`-- foo_mainwebsite
`-- foo_monitoring

In foo_common I put general settings, which are imported and can be
overwritten in specific project. foo_common contains also applications
that are used among all the projects. What I don't like is that models
definitions are spread all over the tree and using south migrations is
sensitive to human errors, like forgetting to set some migration
dependency. Second thing is that I need to run test separately for all
projects, or write some script/runner that will run all tests at one
go.

Cheers

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Re: How to lay out large, *modular* website in Django.

2009-11-17 Thread john2095
Yes.  Django is python and python can handle a modular layout. But
it's not PHP/Zend.  You will have to entirely rewire your brain by
learning Python. There is a respectable curve to climb if you're
coming from PHP.

But to give you some comparison I have about 8 months experience with
django (and a lifetime of programming) and, very recently, to achieve
a similar goal to yours - separate, isolated authentication entry
points - i've managed to cut/paste/rewrite the contrib.auth in, say,
30 hours.  The result uses our models - not joined to auth_user -, is
keyed by email address rather than username, and shares nothing with
an administrator's session  - so different user/pass, reauth if you go
from one 'site' to another.  I expect it will take me another 20-30
hours to bed down the suite of decorators for the permissioning model
we're looking for.

Maybe that helps.

On Nov 18, 7:57 am, "esatterwh...@wi.rr.com" 
wrote:
> I think all you would need to do is organize the permissions and
> assign users to groups with the permissions need to access the various
> views / data.
>
> You could also easily make decorators for the view function. something
> like @employee_login_required that checks if the user is loged in and
> if the logged in user has the permissions to move on. If they don't
> you just redirect them somewhere else or don't display certain links
> in the template to get there ( both is probably the best option ).  or
> check for is_staff  in the User object. or put a check for
> is_employee
>
> I don't think you would need to make a different permissions system,
> you can create any number of permissions for any model and check for
> them in your views and in templates. I would think this is all you
> need to do. Make a permission can_view_stat_site, and check for it.
> @permission_required('yourapp.can_view_stat_site')
> def your_viewcode(self):
> ...
>
> You can import your model into another just like any other python
> module, But this would make your code less modular if that is what you
> are going for. I think the primary problem here is you are trying to
> build a site the same way you did with Zend, but in django (?)
>
> On Nov 17, 4:54 am, zimnyx  wrote:
>
> > Guys,
>
> > I'm trying to lay out Django code for large "website", which consists
> > of four subsytems:
> > - employees' website
> > - statistics website used also by employees
> > - public website (with users accounts)
> > - monitoring webservices
>
> > This four components have different:
> > - auth types,
> > - different user types (employee account has really nothing to do with
> > customer account)
> > - different permission system
> > - different webpage layout, css, media
> > - different forms
>
> > What is common between them:
> > - they use the same database
> > - most of models are shared between
> > - global configuration (database uri, debug level, i18n, session etc.)
>
> > In (for example) Zend Framework it's very easy to lay out:
> > every subsystem is one ZF module and authentication is delegated to
> > appropriate plugin based on detected module. Every module has its own
> > controllers (Django views) + helpers, templates etc. Models connected
> > with specific module are stored within module directory, and "global"
> > models are available for all ZF modules. All rocks in a minute, code
> > has very readable structure.
>
> > Can Django handle such modular code layout?
> > What's your advice?
>
> > Cheers,
> > Piotrek

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Re: How to lay out large, *modular* website in Django.

2009-11-17 Thread esatterwh...@wi.rr.com
I think all you would need to do is organize the permissions and
assign users to groups with the permissions need to access the various
views / data.

You could also easily make decorators for the view function. something
like @employee_login_required that checks if the user is loged in and
if the logged in user has the permissions to move on. If they don't
you just redirect them somewhere else or don't display certain links
in the template to get there ( both is probably the best option ).  or
check for is_staff  in the User object. or put a check for
is_employee

I don't think you would need to make a different permissions system,
you can create any number of permissions for any model and check for
them in your views and in templates. I would think this is all you
need to do. Make a permission can_view_stat_site, and check for it.
@permission_required('yourapp.can_view_stat_site')
def your_viewcode(self):
...

You can import your model into another just like any other python
module, But this would make your code less modular if that is what you
are going for. I think the primary problem here is you are trying to
build a site the same way you did with Zend, but in django (?)

On Nov 17, 4:54 am, zimnyx  wrote:
> Guys,
>
> I'm trying to lay out Django code for large "website", which consists
> of four subsytems:
> - employees' website
> - statistics website used also by employees
> - public website (with users accounts)
> - monitoring webservices
>
> This four components have different:
> - auth types,
> - different user types (employee account has really nothing to do with
> customer account)
> - different permission system
> - different webpage layout, css, media
> - different forms
>
> What is common between them:
> - they use the same database
> - most of models are shared between
> - global configuration (database uri, debug level, i18n, session etc.)
>
> In (for example) Zend Framework it's very easy to lay out:
> every subsystem is one ZF module and authentication is delegated to
> appropriate plugin based on detected module. Every module has its own
> controllers (Django views) + helpers, templates etc. Models connected
> with specific module are stored within module directory, and "global"
> models are available for all ZF modules. All rocks in a minute, code
> has very readable structure.
>
> Can Django handle such modular code layout?
> What's your advice?
>
> Cheers,
> Piotrek

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Re: How to lay out large, *modular* website in Django.

2009-11-17 Thread lzantal
I think you just answered your own question.:)
Each subsystem would be an app.
If you want to keep the auth separate from each other then you need to
subclass auth or create different groups
because every django project has only one auth system.
You could assign different priv level to the different groups.

hope it helps

lzantal
http://twitter.com/lzantal

On Nov 17, 2:54 am, zimnyx  wrote:
> Guys,
>
> I'm trying to lay out Django code for large "website", which consists
> of four subsytems:
> - employees' website
> - statistics website used also by employees
> - public website (with users accounts)
> - monitoring webservices
>
> This four components have different:
> - auth types,
> - different user types (employee account has really nothing to do with
> customer account)
> - different permission system
> - different webpage layout, css, media
> - different forms
>
> What is common between them:
> - they use the same database
> - most of models are shared between
> - global configuration (database uri, debug level, i18n, session etc.)
>
> In (for example) Zend Framework it's very easy to lay out:
> every subsystem is one ZF module and authentication is delegated to
> appropriate plugin based on detected module. Every module has its own
> controllers (Django views) + helpers, templates etc. Models connected
> with specific module are stored within module directory, and "global"
> models are available for all ZF modules. All rocks in a minute, code
> has very readable structure.
>
> Can Django handle such modular code layout?
> What's your advice?
>
> Cheers,
> Piotrek

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




How to lay out large, *modular* website in Django.

2009-11-17 Thread zimnyx
Guys,

I'm trying to lay out Django code for large "website", which consists
of four subsytems:
- employees' website
- statistics website used also by employees
- public website (with users accounts)
- monitoring webservices

This four components have different:
- auth types,
- different user types (employee account has really nothing to do with
customer account)
- different permission system
- different webpage layout, css, media
- different forms

What is common between them:
- they use the same database
- most of models are shared between
- global configuration (database uri, debug level, i18n, session etc.)

In (for example) Zend Framework it's very easy to lay out:
every subsystem is one ZF module and authentication is delegated to
appropriate plugin based on detected module. Every module has its own
controllers (Django views) + helpers, templates etc. Models connected
with specific module are stored within module directory, and "global"
models are available for all ZF modules. All rocks in a minute, code
has very readable structure.

Can Django handle such modular code layout?
What's your advice?

Cheers,
Piotrek

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.