Thursday, January 24, 2013

2 projects, 2 apps, bad templates ...

Noob alert! :D

I work on a server where we have multiple Django projects that all
share one Django installation.

Each project has it's own subdomain.

At this time, we aren't using virtual envs.

Situation:

1. I built a basic application (let's call it FOOAPP) inside of
DjangoProjectA; after using it for a while, I decided to put the app
on GitHub.

2. One of my co-workers wanted to use the same app, but he needed it
on DjangoProjectB; I installed FOOAPP using PIP from GitHub:

$ sudo pip install -e git+https://github.com/user/FOOAPP.git#egg=FOOAPP

... which put it in a "src" folder at the root level of the
DjangoProjectB project directory.

3. DjangoProjectB's FOOAPP now works great.

4. DjangoProjectA's FOOAPP templates all broke.

From what we could tell, FOOAPP from DjangoProjectA was looking at the
template folder from DjangoProjectB.

We fixed the problem by being more explicit in DjangoProjectA's
settings.py file. In other words, we changed this:

INSTALLED_APPS = (
# ...
'FOOAPP',
# ...
)

... to this:

INSTALLED_APPS = (
# ...
'DjangoProjectA.FOOAPP',
# ...
)

And all of our templates came back to life.

Other than setting up virtual environments, is there a better way to
fix the problem? Being more explicit for this one particular app is
fine, bu I think it kinda feels like a dirty patch.

What did we do wrong? Why would Django look in a different project's
app for templates before looking in its own? Tips on how to avoid this
in the future?

Thanks!
M

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate