[TriPython] Django question

Rob Ladd rob.ladd at gmail.com
Fri Aug 11 14:38:06 EDT 2017


Hi Luis,
As you build more projects, you'll get a feel for what goes where. But
there's not one "right" way to do it, of course.
One way to think about it is, "what will the tables look like?"
In the above scenario, all the tables created by the polls app will be
named polls_<model name>. But your landing page, contact pages, etc.
probably won't have models.
If the project isn't going to do much beyond "polls," then you don't need
to separate out to more apps.

But we recently built a big employee reporting project that has about 12
apps. Each app is a different type of reporting, and has its own models,
views, templates, static files, etc. But each app also shares stuff with
other apps.
I made a "central" app simply called "reporting" that has the common
models, like "Employee" and "Department," etc.
Then the individual apps can import those common models.
So you could think of your project that way, too.

Fortunately for you, since those main contents probably won't have any
models associated with them, you can move them around pretty easily if you
want.

In my experience, each time I build a new Django project (developing 2
right now), I learn a possibly better way to do it. Which is super fun.
What you really need to do is get your butt up to DjangoCon next week!! I
can't go this time, but I'm sending one of my team members up. It'll be his
first time.

-Rob

On Fri, Aug 11, 2017 at 1:36 PM Luis Valencia <livalencia at my.waketech.edu>
wrote:

>    Hello all!
>
>    I have a Django question as I'm trying to build a simple website for
>    practice.  I'm trying to build a site that has a forum. I went ahead and
>    created the forum app ($ python manage.py startapp polls) which I then
>    proceeded to install. So far so good, I read a stackoverflow answer that
>    said " Typically you separate Apps based on common function. User
> accounts
>    get their own app (see Auth below). Blog postings get another. A Google
>    Maps interface will get another. User subscriptions, another." This gave
>    me a clearer understanding of how to structure my projects and the apps
>    within.
>
>    My question is should I create another app for the main contents of the
>    site? The main contents for my particular site being the landing page,
> the
>    about page, contact page, etc,.
>
>    On another note I am quite by how quickly and relatively easy is to
> build
>    an app with Django. When I started to learn web development I used Flask
>    and the road was a bit rough.
>
>    All the best,
>
>    Luis
> _______________________________________________
> TriZPUG mailing list
> TriZPUG at python.org
> https://mail.python.org/mailman/listinfo/trizpug
> http://tripython.org is the Triangle Python Users Group
>
-------------- next part --------------
   Hi Luis,
   As you build more projects, you'll get a feel for what goes where. But
   there's not one "right" way to do it, of course.
   One way to think about it is, "what will the tables look like?"
   In the above scenario, all the tables created by the polls app will be
   named polls_<model name>. But your landing page, contact pages, etc.
   probably won't have models.
   If the project isn't going to do much beyond "polls," then you don't need
   to separate out to more apps.
   But we recently built a big employee reporting project that has about 12
   apps. Each app is a different type of reporting, and has its own models,
   views, templates, static files, etc. But each app also shares stuff with
   other apps.
   I made a "central" app simply called "reporting" that has the common
   models, like "Employee" and "Department," etc.
   Then the individual apps can import those common models.
   So you could think of your project that way, too.
   Fortunately for you, since those main contents probably won't have any
   models associated with them, you can move them around pretty easily if you
   want.
   In my experience, each time I build a new Django project (developing 2
   right now), I learn a possibly better way to do it. Which is super fun.
   What you really need to do is get your butt up to DjangoCon next week!! I
   can't go this time, but I'm sending one of my team members up. It'll be
   his first time.
   -Rob
   On Fri, Aug 11, 2017 at 1:36 PM Luis Valencia
   <[1]livalencia at my.waketech.edu> wrote:

     ** **Hello all!

     ** **I have a Django question as I'm trying to build a simple website
     for
     ** **practice.** I'm trying to build a site that has a forum. I went
     ahead and
     ** **created the forum app ($ python manage.py startapp polls) which I
     then
     ** **proceeded to install. So far so good, I read a stackoverflow answer
     that
     ** **said " Typically you separate Apps based on common function. User
     accounts
     ** **get their own app (see Auth below). Blog postings get another. A
     Google
     ** **Maps interface will get another. User subscriptions, another." This
     gave
     ** **me a clearer understanding of how to structure my projects and the
     apps
     ** **within.

     ** **My question is should I create another app for the main contents of
     the
     ** **site? The main contents for my particular site being the landing
     page, the
     ** **about page, contact page, etc,.

     ** **On another note I am quite by how quickly and relatively easy is to
     build
     ** **an app with Django. When I started to learn web development I used
     Flask
     ** **and the road was a bit rough.

     ** **All the best,

     ** **Luis
     _______________________________________________
     TriZPUG mailing list
     [2]TriZPUG at python.org
     [3]https://mail.python.org/mailman/listinfo/trizpug
     [4]http://tripython.org is the Triangle Python Users Group

References

   Visible links
   1. mailto:livalencia at my.waketech.edu
   2. mailto:TriZPUG at python.org
   3. https://mail.python.org/mailman/listinfo/trizpug
   4. http://tripython.org/


More information about the TriZPUG mailing list