[gsoc-dev] GWM Questions - Switching to new layout

pranjal mittal mittal.pranjal at gmail.com
Wed Jul 17 08:29:17 UTC 2013


Thank you, that helps me get a lot more clear on this stuff.

So now, I have managed to refactor my code into a completely separate app *
ganetiviz* which looks like this. *[1]*

I am trying to test-run the "ganetiviz" component of GWM after refactoring
it into a separate app. But I think it requires the merge in of Peter's
changes before.

Other components of GWM work fine, I pulled in the latest develop today.
Rebased my branch over it and there were no problems.
So after the rebase here is a commit summary of my changes in chronological
order *[2]*.

*So what should I be doing now ---- ?*

   1. Send a pull request for these changes from pramttl:feature/13569 to:
   - osuosl:feature/13569
      - osuosl:develop

   2. Wait for Peter's changes to be merged into *develop *and then rebase
   my branch over it* *(ie over develop)?

   3. Rebase my feature branch over Peter's branch [3] itself?


Meanwhile, I will try to make other small independent changes to
"ganetiviz", which do not cause a conflict with Peter's changes to
'develop' while merging.



*[1]
https://github.com/pramttl/ganeti_webmgr/tree/feature/13569/ganeti_web/ganetiviz
*
*[2] http://pastebin.osuosl.org/2650/*
*[3]* *
https://github.com/pbanaszkiewicz/ganeti_webmgr/tree/enhancement/13599/ganeti_web
*




Kind Regards,
- Pranjal



On Wed, Jul 17, 2013 at 5:11 AM, Piotr Banaszkiewicz <
piotr at banaszkiewicz.org> wrote:

> Re: (A)
> As long as Django project uses
> ``django.contrib.staticfiles.finders.AppDirectoriesFinder`` static
> file finder [1] (and it usually does), the discovery of applications'
> static files takes into account their ``static`` directory. More [2]
>
> [1]
> https://docs.djangoproject.com/en/dev/ref/settings/#staticfiles-finders
> [2] https://docs.djangoproject.com/en/dev/howto/static-files/
>
> The same applies to applications' templates. Thanks to
> ``django.template.loaders.app_directories.Loader`` template loader,
> Django searches for templates within installed applications
> ``templates`` directories.
>
> More information [3], [4].
> [3] https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
> [4] https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
>
> Generally speaking, ``TEMPLATE_DIRS`` contains additional, often
> global or external, paths containing templates.
>
>
> Re: (B)
> I don't think Django applications make use of per-application
> ``settings.py``.
> Look for example here [5] to see how others deal with pluggable
> applications and their settings.
>
> [5]
> https://github.com/django-debug-toolbar/django-debug-toolbar/blob/master/debug_toolbar/middleware.py#L53
>
>
> Re: (C)
> You don't have to collect the templates, but, as you said, to collect
> static files in one place we use ``./manage.py collecstatic``
>
>
> I'm happy to answer any further questions :) cheers!
>
> On Tue, Jul 16, 2013 at 7:04 PM, pranjal mittal
> <mittal.pranjal at gmail.com> wrote:
> > Hey Peter,
> >
> > [Adding the gsoc-dev alias so that everyone could see these questions /
> > help.]
> >
> > Thank you for the previous answers. :)
> > I have some further queries (which are more related to Django in itself,
> > actually)
> >
> > (A)
> > Assuming the case that I want to to build a pluggable app. (Though I am
> > still a bit loath to do so now)
> >
> > I add the static, template files of "ganetiviz" respectively into-
> > ganetiviz/static
> > ganetiviz/templates
> >
> > Now even if I plug this application in as a separate app as I see in your
> > changes. [1]
> > How will GWM know where the static, template files for "ganetiviz" are
> > located?
> >
> > TEMPLATE_DIRS setting needs to be defined for this app itself.
> > => need for  creating  ganetiviz/settings.py
> > And whether we can do that or not, comes from an answer to (B)
> >
> > Further, static files will also have to be collected to a central place
> for
> > serving. (C)
> >
> > (B)
> >  When I plugin an external app like in [1] , is the settings.py file of
> each
> > app automatically included into the main Django Application
> > Main Django Application - Defined as the app whose settings.py file is
> > referenced by the manage.py, used to run the server.
> >
> >
> > (C)
> > Are you aware of any kind of  built-in Django feature that automatically
> > imports the
> >
> > new_app/templates
> > new_app/settings
> >
> > into the main Django application automatically. (for the case of static
> > files, the per app static files being collected into the STATIC_ROOT
> defined
> > by the MAIN app on giving collect-static command.)
> >
> >
> > Cheers,
> >
> > [1]
> >
> https://github.com/pbanaszkiewicz/ganeti_webmgr/blob/enhancement/13599/ganeti_web/ganeti_web/settings/local.py#L96
> >
> >
> > On Tue, Jul 16, 2013 at 12:38 PM, Piotr Banaszkiewicz
> > <piotr at banaszkiewicz.org> wrote:
> >>
> >> Hi! :)
> >>
> >> In my opinion you should
> >>
> >> 1. put your static files into ganeti_web/static and your templates
> >> into ganeti_web/templates/ganetiviz/*
> >> (unless you want your application to be pluggable everywhere, not only
> >> into GWM, then create templates subdir in ganetiviz application and
> >> store templates there)
> >>
> >> 2. it's actually possible to have "old" imports with new, refactored
> >> code. Note that ganeti_web/models.py currently imports all three:
> >> Node, Cluster and VirtualMachine:
> >>
> >>
> https://github.com/pbanaszkiewicz/ganeti_webmgr/blob/enhancement/13599/ganeti_web/ganeti_web/models.py#L39
> >>
> >> I think you can use "old-style" imports just to make ganetiviz work,
> >> even if this is a little bit ugly.  Just leave a note in comments near
> >> that imports.
> >>
> >> It's 9AM here and I'm asleep as well...
> >>
> >> On Tue, Jul 16, 2013 at 12:26 AM, pranjal mittal
> >> <mittal.pranjal at gmail.com> wrote:
> >> > Hi Peter,
> >> >
> >> > I had a look at your pull request nicely and the changes you made.
> >> > Though I
> >> > am relatively new to GWM as a developer, but I can imagine how things
> >> > will
> >> > be much better now for all the gwm developers now. :)
> >> >
> >> > Now, I am trying to modularize the code I have been writing into a
> >> > separate
> >> > app called "ganetiviz" [1], as per your scheme.
> >> > Check the link [1] which shows my progress with the modularization.
> >> >
> >> > Following this, I have some blockers-
> >> >
> >> > (1) Where should I add the template files ganetiviz is supposed to
> >> > render?
> >> >
> >> > (2) Where do I add the static files? For now I added them to a js
> >> > subdirectory within "ganetiviz"
> >> >
> >> > (3) I was making use of Node, Cluster, VM models. Should I import them
> >> > from
> >> > the old location or the new location.
> >> >
> >> >
> >> >
> >> > P.S: Some of my questions might seem silly / incomplete? I am already
> >> > half
> >> > asleep. 3:55 am here. ^_-
> >> >
> >> >
> >> > Cheers,
> >> >
> >> > [1]
> >> >
> >> >
> https://github.com/pramttl/ganeti_webmgr/tree/dev_feature/13569/ganeti_web/ganetiviz
> >> >
> >> > --
> >> > Best Regards,
> >> > Pranjal Mittal
> >> > B.Tech.  2014
> >> > Indian Institute of Technology,BHU
> >> > Varanasi, U.P,
> >> > India
> >> >
> >> > Github | LinkedIn | Blog
> >
> >
> >
> >
> > --
> > Best Regards,
> > Pranjal Mittal
> > B.Tech.  2014
> > Indian Institute of Technology,BHU
> > Varanasi, U.P,
> > India
> >
> > Github | LinkedIn | Blog
>



-- 
Best Regards,
Pranjal Mittal
B.Tech.  2014
Indian Institute of Technology,BHU
Varanasi, U.P,
India

Github <http://github.com/pramttl> |
LinkedIn<http://in.linkedin.com/pub/pranjal-mittal/26/660/318/>|
Blog <http://pranjalmittal.in>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/gsoc-dev/attachments/20130717/917d3b70/attachment-0001.html>


More information about the gsoc-dev mailing list