You want your project "foo" to be able to (1) render content from a
template and also (2) handle a request to a specific url.
If you want to do (1), you can add
'django.template.loaders.app_directories.load_template_source' to your
TEMPLATE_LOADERS in your settings file. In fact, it may be there
already. That will automatically look in /templates/ for
any installed apps when resolving template strings:
http://docs.djangoproject.com/en/dev/ref/templates/api/#ref-templates-api
If you want to do (2), you'll have to put something into your main
urls.py file. Why not add it to your urls with an include under a url
prefix like 'foo/' that points to whatever urls.py file you have in
the app 'foo'.
The django admin app is a great example of what you're trying to do,
why not look into how it gets configured and how it organizes its
templates? Maybe also look at django.contrib.comments.
Peter
On Sep 3, 10:07 am, Shawn Milochik wrote:
> I'm working on an existing project that I'm splitting up into multiple
> apps. My question is about how to use those apps together.
>
> Say I have an app called "main." Then two supporting apps which sit
> outside of that Django project folder. They are "foo" and "bar." They
> are not "installed" as Python modules -- they're just in another
> directory on the Python path, and they are added to the INSTALLED_APPS
> of the main project.
>
> Let's say foo has a template which is just a div containing a
> form.as_p tag, and the form it uses is also in the project foo. The
> function to act on that form's submission is in the views.py of foo.
>
> If I want to offer that form on my site from the main app, how do I do
> it? Is it possible to not import the forms, views, and templates from
> foo into main, and just use template tags to load the foo content into
> main and have it processed by foo?
>
> The point is to keep all foo logic outside of the main app, so main
> doesn't have to "know about" foo or any of its internals. This may not
> strictly be a "pluggable" app, but it works for our application. Is
> the way to do this documented anywhere?
>
> Thanks,
> Shawn
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@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=en
-~--~~~~--~~--~--~---